* [PATCH] selinux: make default_noexec read-only after init
@ 2020-01-08 17:23 Stephen Smalley
2020-01-10 17:28 ` Paul Moore
0 siblings, 1 reply; 2+ messages in thread
From: Stephen Smalley @ 2020-01-08 17:23 UTC (permalink / raw)
To: paul; +Cc: selinux, omosnace, Stephen Smalley
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>
---
security/selinux/hooks.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 6777e04fd942..7834f0a4c2a8 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -3650,7 +3650,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)
{
--
2.24.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] selinux: make default_noexec read-only after init
2020-01-08 17:23 [PATCH] selinux: make default_noexec read-only after init Stephen Smalley
@ 2020-01-10 17:28 ` Paul Moore
0 siblings, 0 replies; 2+ messages in thread
From: Paul Moore @ 2020-01-10 17:28 UTC (permalink / raw)
To: Stephen Smalley; +Cc: selinux, omosnace
On Wed, Jan 8, 2020 at 12:23 PM Stephen Smalley <sds@tycho.nsa.gov> wrote:
> 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>
> ---
> security/selinux/hooks.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Merged into selinux/next, thanks!
--
paul moore
www.paul-moore.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-01-10 17:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-08 17:23 [PATCH] selinux: make default_noexec read-only after init Stephen Smalley
2020-01-10 17:28 ` Paul Moore
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.