You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A new class "memfd_file" is introduced to the kernel in [1]. This class
is only used when the policy capability "memfd_class" is set. Add tests
to validate this new class:
1. Validate that memfd_create() requires the "create" permission.
2. Validate that fexecve() on a memfd requires the "execute_no_trans"
permission.
This can be tested by modifying the policy with:
semodule -c -E base
sed -i \
-e 's/\((class user_namespace (create ))\)/\1\n(class memfd_file (execute_no_trans entrypoint ))\n(classcommon memfd_file file)/' \
-e 's/\(anon_inode socket\)/memfd_file \1/' \
base.cil
echo "(policycap memfd_class)" > memfdclass.cil
semodule -i base.cil memfdclass.cil
rm -f base.cil
sed -i.orig \
-e 's/\(define(`all_file_perms'\'',\)\(.*\)$/\1\2\ndefine(`all_memfd_file_perms'\'',\2/' \
-e 's/\(class file all_file_perms;\)/\1\nclass memfd_file all_memfd_file_perms;/' \
/usr/share/selinux/devel/include/support/all_perms.spt
Then, after running the tests, undo these changes as follows:
semodule -r base memfdclass
mv /usr/share/selinux/devel/include/support/all_perms.spt.orig \
/usr/share/selinux/deve/include/support/all_perms.spt
[1] https://lore.kernel.org/selinux/[email protected]/
Signed-off-by: Thiébaud Weksteen <[email protected]>
Reviewed-by: Stephen Smalley <[email protected]>
Tested-by: Stephen Smalley <[email protected]>
0 commit comments