]> git.baikalelectronics.ru Git - kernel.git/commit
x86/pkeys: Skip 'init_pkru' debugfs file creation when pkeys not supported
authorDave Hansen <dave.hansen@linux.intel.com>
Thu, 3 Jun 2021 23:08:10 +0000 (16:08 -0700)
committerBorislav Petkov <bp@suse.de>
Fri, 4 Jun 2021 15:01:03 +0000 (17:01 +0200)
commitef3f0a394d0036885cf22d7ef18fbe9b9e0b8b54
treebf631cce69652b52c9b4716c6b33c2a0fdcf541e
parent522fa64953e0d3fbb5fa5fd7565121714af2a489
x86/pkeys: Skip 'init_pkru' debugfs file creation when pkeys not supported

The PKRU hardware is permissive by default: all reads and writes are
allowed.  The in-kernel policy is restrictive by default: deny all
unnecessary access until explicitly requested.

That policy can be modified with a debugfs file: "x86/init_pkru".
This file is created unconditionally, regardless of PKRU support in
the hardware, which is a little silly.

Avoid creating the file when pkeys are not available.  This also
removes the need to check for pkey support at runtime, which would be
required once the new pkey modification infrastructure is put in place
later in this series.

Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/20210603230810.113FF3F2@viggo.jf.intel.com
arch/x86/mm/pkeys.c