summaryrefslogtreecommitdiff
path: root/arch/x86/mm
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2021-06-28 13:27:46 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2021-06-28 13:27:46 -0700
commit5f498328a91b59841557b8c4e8f0360e509dd454 (patch)
treeb8c7905d08a1ab4b993aa30c1a75cd9b8ac4bd8c /arch/x86/mm
parente98e8864b0b553389bbb7d2ed197729a434ba0f0 (diff)
parent314a1e1eabea5b86532e90e0d4e217fa88471e3b (diff)
Merge tag 'x86-mm-2021-06-28' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 mm update from Ingo Molnar: "Do not create the x86/init_pkru debugfs file if the CPU doesn't support PKRU" * tag 'x86-mm-2021-06-28' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/pkeys: Skip 'init_pkru' debugfs file creation when pkeys not supported
Diffstat (limited to 'arch/x86/mm')
-rw-r--r--arch/x86/mm/pkeys.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/x86/mm/pkeys.c b/arch/x86/mm/pkeys.c
index a2332eef66e9..4a67b922bce1 100644
--- a/arch/x86/mm/pkeys.c
+++ b/arch/x86/mm/pkeys.c
@@ -192,6 +192,10 @@ static const struct file_operations fops_init_pkru = {
static int __init create_init_pkru_value(void)
{
+ /* Do not expose the file if pkeys are not supported. */
+ if (!cpu_feature_enabled(X86_FEATURE_OSPKE))
+ return 0;
+
debugfs_create_file("init_pkru", S_IRUSR | S_IWUSR,
arch_debugfs_dir, NULL, &fops_init_pkru);
return 0;