selinuxns: mark init_selinux_ns as __ro_after_init
RFC PATCH 1/1 selinuxns: mark init_selinux_ns as __ro_after_init
This is a patch against the SELinux namespace work.
Mark the initial SELinux namespace pointer as __ro_after_init, to harden against malicious overwrite by an attacker.
--- security/selinux/hooks.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
security/selinux/hooks.c +1 -1
@@ -97,7 +97,7 @@#include "audit.h" #include "avc_ss.h" -struct selinux_ns *init_selinux_ns; +struct selinux_ns *init_selinux_ns__ro_after_init ;/* SECMARK reference count */ static atomic_t selinux_secmark_refcount =ATOMIC_INIT (0 );
Signature · 6 lines
1.8.3.1 -- James Morris <[email protected]>
Quoted 7 lines · James Morris
This is a patch against the SELinux namespace work.
Mark the initial SELinux namespace pointer as
__ro_after_init, to harden
against malicious overwrite by an attacker.Signed-off-by James Morris <[email protected]>
Thanks, this looks fine; I can apply it on my branch if you want. Note however that at this point, I am looking more for design discussion and resolution of the problems noted in the patch descriptions for the existing patches, and anticipate many of those patches being substantially rewritten or discarded in any final versiopn. This particular patch however could likely be rebased on top of the first patch in the series and wouldn't be affected by such changes.
Quoted 21 lines
---
security/selinux/hooks.c | 2 +-1 file changed, 1 insertion(+), 1 deletion(-)security/selinux/hooks.c +0
-0@@ -97,7 +97,7 @@ #include "audit.h" #include "avc_ss.h"security/selinux/hooks.c +1
-1-struct selinux_ns *init_selinux_ns; +struct selinux_ns *init_selinux_ns__ro_after_init ;
/* SECMARK reference count */
staticatomic_tselinux_secmark_refcount=ATOMIC_INIT(0); --
1.8.3.1