Commit 5f498328 authored by Linus Torvalds's avatar Linus Torvalds

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
parents e98e8864 314a1e1e
...@@ -192,6 +192,10 @@ static const struct file_operations fops_init_pkru = { ...@@ -192,6 +192,10 @@ static const struct file_operations fops_init_pkru = {
static int __init create_init_pkru_value(void) 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, debugfs_create_file("init_pkru", S_IRUSR | S_IWUSR,
arch_debugfs_dir, NULL, &fops_init_pkru); arch_debugfs_dir, NULL, &fops_init_pkru);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment