policy: allow user_namespace::create where appropriate
PATCH 1/1 policy: allow user_namespace::create where appropriate
The cap_userns test's helper program needs this new permission for its operation - detect the support of it and conditionally add the necessary rule.
--- policy/Makefile | 4 ++++ policy/test_cap_userns.te | 1 + policy/test_global.te | 4 ++++ 3 files changed, 9 insertions(+)
policy/Makefile +4 -0
@@ -166,6 +166,10 @@ ifeq ($(shell grep -q anon_inode $(POLDEV)/include/support/all_perms.spt && echo TARGETS += test_secretmem.te endif +ifeq ($(shell grep -q user_namespace $(POLDEV)/include/support/all_perms.spt && echo true),true) +export M4PARAM += -Duser_namespace_defined +endif + all: build expand_check:
policy/test_cap_userns.te +1 -0
@@ -19,5 +19,6 @@ testsuite_domain_type(test_no_cap_userns_t) typeattribute test_no_cap_userns_t capusernsdomain; # Rules common to both domains. +allow_userns_create(capusernsdomain) # linux >= v5.12 needs setfcap to map UID 0 allow capusernsdomain self:capability setfcap;
policy/test_global.te +4 -0
@@ -171,3 +171,7 @@ ifdef(`lockdown_defined', `allow $1 self:lockdown integrity;') define(`allow_lockdown_confidentiality', ifdef(`lockdown_defined', `allow $1 self:lockdown confidentiality;') ) + +define(`allow_userns_create', +ifdef(`user_namespace_defined', `allow $1 self:user_namespace create;') +)
Signature · 1 line
2.38.1
Quoted 51 lines · Ondrej Mosnacek
The
cap_usernstest's helper program needs this new permission for its operation - detect the support of it and conditionally add the necessary rule.Signed-off-by Ondrej Mosnacek <[email protected]>--- policy/Makefile | 4 ++++ policy/test_cap_userns.te | 1 + policy/test_global.te | 4 ++++ 3 files changed, 9 insertions(+)policy/Makefile +4
-0@@ -166,6 +166,10 @@ ifeq ($(shell grep -q anon_inode $(POLDEV)/include/support/all_perms.spt && echo TARGETS += test_secretmem.te endif +ifeq ($(shell grep -q user_namespace $(POLDEV)/include/support/all_perms.spt && echo true),true) +export M4PARAM += -Duser_namespace_defined +endif + all: build expand_check:policy/test_cap_userns.te +1
-0@@ -19,5 +19,6 @@ testsuite_domain_type(test_no_cap_userns_t) typeattribute test_no_cap_userns_t capusernsdomain; # Rules common to both domains. +allow_userns_create(capusernsdomain) # linux >= v5.12 needs setfcap to map UID 0 allow capusernsdomain self:capability setfcap;policy/test_global.te +4
-1@@ -171,3 +171,7 @@ ifdef(`lockdown_defined', `allow $1 self:lockdown integrity;') define(`allow_lockdown_confidentiality', ifdef(`lockdown_defined', `allow $1 self:lockdown confidentiality;') ) + +define(`allow_userns_create', +ifdef(`user_namespace_defined', `allow $1 self:user_namespace create;') +) --
Quoted 2 lines
2.38.1
This patch is now applied:
https://github.com/SELinuxProject/selinux-testsuite/commit/3389abeaa3bb6fdf23a0f2d8b1550fae69f9c52e
Signature · 3 lines
Ondrej Mosnacek Senior Software Engineer, Linux Security - SELinux kernel Red Hat, Inc.
Paul Moore
maintainerQuoted 13 lines · Ondrej Mosnacek
Quoted 11 lines · Ondrej Mosnacek
The
cap_usernstest's helper program needs this new permission for its operation - detect the support of it and conditionally add the necessary rule.Signed-off-by Ondrej Mosnacek <[email protected]>--- policy/Makefile | 4 ++++ policy/test_cap_userns.te | 1 + policy/test_global.te | 4 ++++ 3 files changed, 9 insertions(+)
...
Quoted 2 lines
This patch is now applied:
https://github.com/SELinuxProject/selinux-testsuite/commit/3389abeaa3bb6fdf23a0f2d8b1550fae69f9c52e
Thanks
Signature · 1 line
paul-moore.com