[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250916163252.354989948@linutronix.de>
Date: Tue, 16 Sep 2025 18:33:19 +0200 (CEST)
From: Thomas Gleixner <tglx@...utronix.de>
To: LKML <linux-kernel@...r.kernel.org>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
Peter Zijlstra <peterz@...radead.org>,
Alexander Viro <viro@...iv.linux.org.uk>,
Christian Brauner <brauner@...nel.org>,
Jan Kara <jack@...e.cz>,
linux-fsdevel@...r.kernel.org,
kernel test robot <lkp@...el.com>,
Russell King <linux@...linux.org.uk>,
linux-arm-kernel@...ts.infradead.org,
Nathan Chancellor <nathan@...nel.org>,
Christophe Leroy <christophe.leroy@...roup.eu>,
Darren Hart <dvhart@...radead.org>,
Davidlohr Bueso <dave@...olabs.net>,
André Almeida <andrealmeid@...lia.com>,
x86@...nel.org
Subject: [patch V2 6/6] select: Convert to scoped masked user access
From: Thomas Gleixner <tglx@...utronix.de>
Replace the open coded implementation with the scoped masked user access
mechanism.
No functional change intended.
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
Cc: Alexander Viro <viro@...iv.linux.org.uk>
Cc: Christian Brauner <brauner@...nel.org>
Cc: Jan Kara <jack@...e.cz>
Cc: linux-fsdevel@...r.kernel.org
---
fs/select.c | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
---
--- a/fs/select.c
+++ b/fs/select.c
@@ -776,18 +776,12 @@ 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_masked_user_rw_access(from, return -EFAULT, {
+ scoped_get_user(to->p, &from->p);
+ scoped_get_user(to->size, &from->size);
+ });
}
return 0;
-Efault:
- user_read_access_end();
- return -EFAULT;
}
SYSCALL_DEFINE6(pselect6, int, n, fd_set __user *, inp, fd_set __user *, outp,
Powered by blists - more mailing lists