[RFC PATCH 04/10] selinuxns: mark init_selinux_ns as __ro_after_init

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: James Morris <james.l.morris@xxxxxxxxxx>

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 <james.l.morris@xxxxxxxxxx>
[sds@xxxxxxxxxxxxx: ported to v5.4-rc1]
Signed-off-by: Stephen Smalley <sds@xxxxxxxxxxxxx>
---
 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 7a4ed553cec0..dc0b143ffa55 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -7096,7 +7096,7 @@ void __put_selinux_ns(struct selinux_ns *ns)
 	schedule_work(&ns->work);
 }
 
-static struct selinux_ns *init_selinux_ns;
+static struct selinux_ns *init_selinux_ns  __ro_after_init;
 
 static __init int selinux_init(void)
 {
-- 
2.21.0




[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux