[PATCH v2 next 5/5] signal: Use scoped_user_access() instead of __put/get_user()

Christophe Leroy (CS GROUP) chleroy at kernel.org
Mon Mar 2 08:07:14 PST 2026



Le 02/03/2026 à 14:27, david.laight.linux at gmail.com a écrit :
> From: David Laight <david.laight.linux at gmail.com>
> 
> Mechanically change the access_ok() and __get/put_user() to use
> scoped_user_read/write_access() and unsafe_get/put_user().
> 
> This generates better code with fewer STAC/CLAC pairs.
> 
> It also ensures that access_ok() is called near the user accesses.
> I failed to find the one for __save_altstack().

On arm64 it's done in get_sigframe() it seems.

> 
> Looking at the change, perhaps there should be aliases:
> #define scoped_put_user unsafe_put_user
> #define scoped_get_user unsafe_get_user

Might be confusing to have two macros doing exactly the same thing.

And the churn might be unnecessary on some code that already widely use 
unsafe_xxx macros and that we want to convert to scoped user access, 
like for instance arch/powerpc/kernel/signal_32.c

Christophe




More information about the linux-riscv mailing list