[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20251220215608.434614-1-david.laight.linux@gmail.com>
Date: Sat, 20 Dec 2025 21:56:03 +0000
From: david.laight.linux@...il.com
To: Thomas Gleixner <tglx@...utronix.de>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Peter Zijlstra <peterz@...radead.org>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
Kees Cook <kees@...nel.org>,
linux-kernel@...r.kernel.org,
akpm@...ux-foundation.org,
Al Viro <viro@...iv.linux.org.uk>
Cc: David Laight <david.laight.linux@...il.com>
Subject: [PATCH 0/5] uaccess: Updates to scoped_user_access()
From: David Laight <david.laight.linux@...il.com>
Converting kernel/signal.c to use scoped_user_access() had compilation
warnings because some of the pointers are 'pointer to const'.
This is fixed in patch 1.
Patches 2 and 3 factor out the 'autoterminating nested for loops'.
I'm sure there'll be a 'bikeshed' discussion about the names.
I think the two 'typeof(uptr)' could be 'auto', compiles for me
but IIRC there are issues with old compilers.
Patch 4 stops warnings from -Wshadow (enabled by W=2).
I did think about making the _diag_xxx conditional on a W=2 build,
but since the pre-processor just emits #pragma lines and they are
smaller that the for() loop it doesn't seem worth while.
Patch 5 is the change to signal.c that prompted patch 1.
The generated code looks fine, but I've not tested it.
Most of the changes are to 'compat' code - so are probably not
usually performance critical.
IIRC the non-compat code uses copy_to/from_user() for the structures
so is probably slower than the compat code's member by member copy.
David Laight (5):
uaccess: Fix scoped_user_read_access() for 'pointer to const'
compiler.h: Add generic support for 'autoterminating nested for()
loops'
uaccess.h: Use with() and and_with() in __scoped_user_access()
uaccess: Disable -Wshadow in __scoped_user_access()
signal: Use scoped_user_access() instead of __put/get_user()
include/linux/compiler.h | 26 +++++++++++++++
include/linux/uaccess.h | 32 +++++++++---------
kernel/signal.c | 72 +++++++++++++++++++++++-----------------
3 files changed, 84 insertions(+), 46 deletions(-)
--
2.39.5
Powered by blists - more mailing lists