summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2024-09-22 21:19:35 +0300
committerLinus Torvalds <torvalds@linux-foundation.org>2024-09-22 21:19:35 +0300
commitde5cb0dcb74c294ec527eddfe5094acfdb21ff21 (patch)
treef669adb523b265f9b979c136df8a8334ea74ec62 /include
parentaf9c191ac2a0c857f59d75b6812fef078ab1cefe (diff)
parent533ab223aa1a036cfe5d6747fa3be92069f80988 (diff)
downloadlinux-de5cb0dcb74c294ec527eddfe5094acfdb21ff21.tar.xz
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 'include')
-rw-r--r--include/linux/uaccess.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/linux/uaccess.h b/include/linux/uaccess.h
index d8e4105a2f21..39c7cf82b0c2 100644
--- a/include/linux/uaccess.h
+++ b/include/linux/uaccess.h
@@ -33,6 +33,13 @@
})
#endif
+#ifdef masked_user_access_begin
+ #define can_do_masked_user_access() 1
+#else
+ #define can_do_masked_user_access() 0
+ #define masked_user_access_begin(src) NULL
+#endif
+
/*
* Architectures should provide two primitives (raw_copy_{to,from}_user())
* and get rid of their private instances of copy_{to,from}_user() and