Re: [PATCH v2 next 5/5] signal: Use scoped_user_access() instead of __put/get_user()
From: Christophe Leroy (CS GROUP)
Date: Mon Mar 02 2026 - 11:12:15 EST
Le 02/03/2026 à 14:27, david.laight.linux@xxxxxxxxx a écrit :
From: David Laight <david.laight.linux@xxxxxxxxx>
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