summaryrefslogtreecommitdiff
path: root/security
diff options
context:
space:
mode:
authorStephen Smalley <sds@tycho.nsa.gov>2020-01-08 20:23:56 +0300
committerPaul Moore <paul@paul-moore.com>2020-01-10 20:26:20 +0300
commitb78b7d59bdbe6028ab362c2551dc684872f2052a (patch)
tree0fdca3b57d0e335a61ea3de4a5b5469dd05df296 /security
parentfe49c7e4f85a9b2c3628e2f21e973ea6e26d2be7 (diff)
downloadlinux-b78b7d59bdbe6028ab362c2551dc684872f2052a.tar.xz
selinux: make default_noexec read-only after init
SELinux checks whether VM_EXEC is set in the VM_DATA_DEFAULT_FLAGS during initialization and saves the result in default_noexec for use in its mmap and mprotect hook function implementations to decide whether to apply EXECMEM, EXECHEAP, EXECSTACK, and EXECMOD checks. Mark default_noexec as ro_after_init to prevent later clearing it and thereby disabling these checks. It is only set legitimately from init code. Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov> Signed-off-by: Paul Moore <paul@paul-moore.com>
Diffstat (limited to 'security')
-rw-r--r--security/selinux/hooks.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 81f570cffee5..921283f47862 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -3647,7 +3647,7 @@ static int selinux_file_ioctl(struct file *file, unsigned int cmd,
return error;
}
-static int default_noexec;
+static int default_noexec __ro_after_init;
static int file_map_prot_check(struct file *file, unsigned long prot, int shared)
{