Thread (61 messages) 61 messages, 12 authors, 2022-02-16

Re: [PATCH 07/14] uaccess: generalize access_ok()

From: Arnd Bergmann <arnd@kernel.org>
Date: 2022-02-14 21:21:15
Also in: linux-alpha, linux-api, linux-arch, linux-m68k, linux-mips, linux-mm, linux-riscv, linux-s390, linux-sh, linux-um, lkml, sparclinux

On Mon, Feb 14, 2022 at 6:15 PM Al Viro [off-list ref] wrote:
On Mon, Feb 14, 2022 at 05:34:45PM +0100, Arnd Bergmann wrote:
quoted
diff --git a/arch/csky/kernel/signal.c b/arch/csky/kernel/signal.c
index c7b763d2f526..8867ddf3e6c7 100644
--- a/arch/csky/kernel/signal.c
+++ b/arch/csky/kernel/signal.c
@@ -136,7 +136,7 @@ static inline void __user *get_sigframe(struct ksignal *ksig,
 static int
 setup_rt_frame(struct ksignal *ksig, sigset_t *set, struct pt_regs *regs)
 {
-     struct rt_sigframe *frame;
+     struct rt_sigframe __user *frame;
      int err = 0;

      frame = get_sigframe(ksig, regs, sizeof(*frame));
Minor nit: might make sense to separate annotations (here, on nios2, etc.) from the rest...
Done.
quoted
-}
-
-static inline int access_ok(const void __user * addr, unsigned long size)
-{
-     return 1;
-}
+#define __range_not_ok(addr, size, limit) (!__access_ok(addr, size))
is really wrong.  For sparc64, access_ok() should always be true.
This __range_not_ok() thing is used *only* for valid_user_frame() in
arch/sparc/kernel/perf_event.c - it's not a part of normal access_ok()
there.

sparc64 has separate address spaces for kernel and for userland; access_ok()
had never been useful there.
Ok, fixed as well now. I had the access_ok() bit right, the definition just
moved around here so it comes before the #include, but I missed the
bit about __range_not_ok(), which I have now reverted back to the
correct version in my tree.

        Arnd
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help