[patch V5 12/12] select: Convert to scoped user access

Christophe Leroy christophe.leroy at csgroup.eu
Tue Nov 4 17:32:02 AEDT 2025



Le 27/10/2025 à 09:44, Thomas Gleixner a écrit :
> From: Thomas Gleixner <tglx at linutronix.de>
> 
> Replace the open coded implementation with the scoped user access guard.
> 
> No functional change intended.
> 
> Signed-off-by: Thomas Gleixner <tglx at linutronix.de>
> Cc: Alexander Viro <viro at zeniv.linux.org.uk>
> Cc: Christian Brauner <brauner at kernel.org>
> Cc: Jan Kara <jack at suse.cz>
> Cc: linux-fsdevel at vger.kernel.org

Reviewed-by: Christophe Leroy <christophe.leroy at csgroup.eu>

> ---
> V4: Use read guard - Peterz
>      Rename once more
> V3: Adopt to scope changes
> ---
>   fs/select.c |   12 ++++--------
>   1 file changed, 4 insertions(+), 8 deletions(-)
> ---
> --- a/fs/select.c
> +++ b/fs/select.c
> @@ -776,17 +776,13 @@ static inline int get_sigset_argpack(str
>   {
>   	// the path is hot enough for overhead of copy_from_user() to matter
>   	if (from) {
> -		if (can_do_masked_user_access())
> -			from = masked_user_access_begin(from);
> -		else if (!user_read_access_begin(from, sizeof(*from)))
> -			return -EFAULT;
> -		unsafe_get_user(to->p, &from->p, Efault);
> -		unsafe_get_user(to->size, &from->size, Efault);
> -		user_read_access_end();
> +		scoped_user_read_access(from, Efault) {
> +			unsafe_get_user(to->p, &from->p, Efault);
> +			unsafe_get_user(to->size, &from->size, Efault);
> +		}
>   	}
>   	return 0;
>   Efault:
> -	user_read_access_end();
>   	return -EFAULT;
>   }
>   
> 



More information about the Linuxppc-dev mailing list