Skip to content

uaccess: Updates to scoped_user_access()

[email protected] linux-arm-kernel linux-fsdevel linux-riscv linux-s390 linuxppc-dev lkml oe-kbuild-all 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest5 patches 7 repliesIn review
  2. v15 patches 0 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5uaccess: Fix scoped_user_read_access() for 'pointer to const'include/linux/uaccess.h+20 -343 replies
2/5compiler.h: Add generic support for 'autoterminating nested for() loops'include/linux/compiler.h+26 -00 replies
3/5uaccess.h: Use with() and and_with() in __scoped_user_access()include/linux/uaccess.h+4 -70 replies
4/5uaccess: Disable -Wshadow in __scoped_user_access()include/linux/uaccess.h+3 -13 replies
5/5signal: Use scoped_user_access() instead of __put/get_user()kernel/signal.c+42 -301 reply

Reviews trailers per patch

1 of 5 patches has a Reviewed-by or Acked-by.

PatchChristophe Leroy (CS GROUP)
1/5R-b T-b
2/5
3/5
4/5
5/5

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/5] uaccess: Updates to scoped_user_access()

From: David Laight <[email protected]>

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.

The same problem has been found compiling arch/powerpc/lib/checksum_wrappers.c

For v2 I've changed the code to use 'auto' and replaced the over-complex CLASS definition (and its for loop) with a much simpler __cleanup() function on the second loop.

Patches 2 and 3 factor out the 'autoterminating nested for loops'. I'm sure there'll be a 'bikeshed' discussion about the names.

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  | 51 ++++++++++------------------
 kernel/signal.c          | 72 +++++++++++++++++++++++-----------------
 3 files changed, 86 insertions(+), 63 deletions(-)
Signature · 1 line
2.39.5