summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2026-10-20 09:55:28 -1000
committerLinus Torvalds <torvalds@linux-foundation.org>2026-10-20 10:13:49 -1000
commitbb4e937ff6857ca9277d35683682ea4c1f75ff2a (patch)
tree3a076c66eefbbac9e1d7d43572e09c3da168fe82
parent48e5959144e40506b38b383ce0e9feed95cdf68a (diff)
downloadlinux-bb4e937ff6857ca9277d35683682ea4c1f75ff2a.tar.gz
linux-bb4e937ff6857ca9277d35683682ea4c1f75ff2a.zip
s390: use get_user()/put_user() instead of the unchecked variants
On s390 user space is a separate address space, so access_ok() has nothing to check, and get_user() and put_user() are __get_user() and __put_user() plus might_fault(). The remaining callers can use the normal accessors directly: - signal frame setup writes the back chain, the signal number and the ucontext header in process context; - the user stack walker for stack traces and perf callchains already runs under pagefault_disable(), where might_fault() returns early; - the general register set writer for ptrace runs in the tracer's process context with no locks held. This is part of getting rid of __get_user() and __put_user() entirely. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--arch/s390/kernel/ptrace.c2
-rw-r--r--arch/s390/kernel/signal.c10
-rw-r--r--arch/s390/kernel/stacktrace.c8
3 files changed, 10 insertions, 10 deletions
diff --git a/arch/s390/kernel/ptrace.c b/arch/s390/kernel/ptrace.c
index 125ca4c4e30c..06c6901d7c41 100644
--- a/arch/s390/kernel/ptrace.c
+++ b/arch/s390/kernel/ptrace.c
@@ -540,7 +540,7 @@ static int s390_regs_set(struct task_struct *target,
const unsigned long __user *u = ubuf;
while (count > 0 && !rc) {
unsigned long word;
- rc = __get_user(word, u++);
+ rc = get_user(word, u++);
if (rc)
break;
rc = __poke_user(target, pos, word);
diff --git a/arch/s390/kernel/signal.c b/arch/s390/kernel/signal.c
index 4874de5edea0..81709cd2e9e5 100644
--- a/arch/s390/kernel/signal.c
+++ b/arch/s390/kernel/signal.c
@@ -297,7 +297,7 @@ static int setup_frame(int sig, struct k_sigaction *ka,
return -EFAULT;
/* Set up backchain. */
- if (__put_user(regs->gprs[15], (addr_t __user *) frame))
+ if (put_user(regs->gprs[15], (addr_t __user *) frame))
return -EFAULT;
/* Create struct sigcontext on the signal stack */
@@ -314,7 +314,7 @@ static int setup_frame(int sig, struct k_sigaction *ka,
return -EFAULT;
/* Place signal number on stack to allow backtrace from handler. */
- if (__put_user(regs->gprs[2], (int __user *) &frame->signo))
+ if (put_user(regs->gprs[2], (int __user *) &frame->signo))
return -EFAULT;
/* Create _sigregs_ext on the signal stack */
@@ -370,7 +370,7 @@ static int setup_rt_frame(struct ksignal *ksig, sigset_t *set,
return -EFAULT;
/* Set up backchain. */
- if (__put_user(regs->gprs[15], (addr_t __user *) frame))
+ if (put_user(regs->gprs[15], (addr_t __user *) frame))
return -EFAULT;
/* Set up to return from userspace. If provided, use a stub
@@ -388,8 +388,8 @@ static int setup_rt_frame(struct ksignal *ksig, sigset_t *set,
store_sigregs();
/* Create ucontext on the signal stack. */
- if (__put_user(uc_flags, &frame->uc.uc_flags) ||
- __put_user(NULL, &frame->uc.uc_link) ||
+ if (put_user(uc_flags, &frame->uc.uc_flags) ||
+ put_user(NULL, &frame->uc.uc_link) ||
__save_altstack(&frame->uc.uc_stack, regs->gprs[15]) ||
save_sigregs(regs, &frame->uc.uc_mcontext) ||
__copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)) ||
diff --git a/arch/s390/kernel/stacktrace.c b/arch/s390/kernel/stacktrace.c
index 18520d333058..191f8a93371e 100644
--- a/arch/s390/kernel/stacktrace.c
+++ b/arch/s390/kernel/stacktrace.c
@@ -113,7 +113,7 @@ void arch_stack_walk_user_common(stack_trace_consume_fn consume_entry, void *coo
sf = (void __user *)user_stack_pointer(regs);
pagefault_disable();
while (1) {
- if (__get_user(sp, &sf->back_chain))
+ if (get_user(sp, &sf->back_chain))
break;
/*
* VDSO entry code has a non-standard stack frame layout.
@@ -121,15 +121,15 @@ void arch_stack_walk_user_common(stack_trace_consume_fn consume_entry, void *coo
*/
if (!sp && ip_within_vdso(ip)) {
sf_vdso = (void __user *)sf;
- if (__get_user(ip, &sf_vdso->return_address))
+ if (get_user(ip, &sf_vdso->return_address))
break;
sp = (unsigned long)sf + STACK_FRAME_VDSO_OVERHEAD;
sf = (void __user *)sp;
- if (__get_user(sp, &sf->back_chain))
+ if (get_user(sp, &sf->back_chain))
break;
} else {
sf = (void __user *)sp;
- if (__get_user(ip, &sf->gprs[8]))
+ if (get_user(ip, &sf->gprs[8]))
break;
}
/* Validate SP and RA (ABI requires SP to be 8 byte aligned). */