diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2024-09-22 20:19:35 +0200 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2024-09-22 20:19:35 +0200 |
commit | de5cb0dcb74c294ec527eddfe5094acfdb21ff21 (patch) | |
tree | f669adb523b265f9b979c136df8a8334ea74ec62 /fs/select.c | |
parent | Merge tag 'trace-ring-buffer-v6.12' of git://git.kernel.org/pub/scm/linux/ker... (diff) | |
parent | x86: make the masked_user_access_begin() macro use its argument only once (diff) | |
download | linux-de5cb0dcb74c294ec527eddfe5094acfdb21ff21.tar.xz linux-de5cb0dcb74c294ec527eddfe5094acfdb21ff21.zip |
Merge branch 'address-masking'
Merge user access fast validation using address masking.
This allows architectures to optionally use a data dependent address
masking model instead of a conditional branch for validating user
accesses. That avoids the Spectre-v1 speculation barriers.
Right now only x86-64 takes advantage of this, and not all architectures
will be able to do it. It requires a guard region between the user and
kernel address spaces (so that you can't overflow from one to the
other), and an easy way to generate a guaranteed-to-fault address for
invalid user pointers.
Also note that this currently assumes that there is no difference
between user read and write accesses. If extended to architectures like
powerpc, we'll also need to separate out the user read-vs-write cases.
* address-masking:
x86: make the masked_user_access_begin() macro use its argument only once
x86: do the user address masking outside the user access area
x86: support user address masking instead of non-speculative conditional
Diffstat (limited to 'fs/select.c')
-rw-r--r-- | fs/select.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/select.c b/fs/select.c index cae82e9e0dcc..437034ed85c6 100644 --- a/fs/select.c +++ b/fs/select.c @@ -777,7 +777,9 @@ static inline int get_sigset_argpack(struct sigset_argpack *to, { // the path is hot enough for overhead of copy_from_user() to matter if (from) { - if (!user_read_access_begin(from, sizeof(*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); |