[PATCH] profiles: allow /proc/self writes for SELinux outside of SELinux profiles
Sam James <[email protected]>
| Newsgroups | gmane.linux.gentoo.devel |
|---|---|
| Message-ID | <7c25032da833eade55cc0f19cc75274c2b691c05.1779752806.git.sam@gentoo.org> |
When cross-compiling on a SELinux system where the profile has not yet been set for the target (i.e. embedded profile) or where a non-SELinux profile has been selected, writes to /proc/thread-self/attr/fscreate will be prevented by the sandbox: ``` >>> Completed installing sys-libs/timezone-data-2026b into /usr/alpha-unknown-linux-gnu/tmp/portage/sys-libs/timezone-data-2026b/image * Final size of build directory: 9820 KiB (9.5 MiB) * Final size of installed tree: 2720 KiB (2.6 MiB) * ACCESS DENIED: open_wr: /proc/thread-self/attr/fscreate sed: warning: failed to set default file creation context to staff_u:object_r:usr_t:s0: Permission denied * ACCESS DENIED: open_wr: /proc/thread-self/attr/fscreate strip: alpha-unknown-linux-gnu-strip --strip-unneeded -N __gentoo_check_ldflags__ -R .comment -R .GCC.command.line -R .note.gnu.gold-version /usr/bin/zdump ``` I don't see a reason to not allow these through the sandbox on other profiles, as it should be harmless. Signed-off-by: Sam James <[email protected]> --- profiles/{features/selinux => embedded}/profile.bashrc | 0 profiles/releases/23.0/profile.bashrc | 5 +++++ 2 files changed, 5 insertions(+) copy profiles/{features/selinux => embedded}/profile.bashrc (100%) diff --git a/profiles/features/selinux/profile.bashrc b/profiles/embedded/profile.bashrc similarity index 100% copy from profiles/features/selinux/profile.bashrc copy to profiles/embedded/profile.bashrc diff --git a/profiles/releases/23.0/profile.bashrc b/profiles/releases/23.0/profile.bashrc index ae82a4b3216e5..85efd234fefc2 100644 --- a/profiles/releases/23.0/profile.bashrc +++ b/profiles/releases/23.0/profile.bashrc @@ -1,3 +1,8 @@ +# SELinux-aware progams write to entries here +SANDBOX_WRITE="${SANDBOX_WRITE}:/selinux/:/sys/fs/selinux/" + +# for setfscreatecon +SANDBOX_WRITE="${SANDBOX_WRITE}:/proc/self/" __gentoo_get_disk_splitmerge() { # does /bin exist? important for baselayout -- 2.54.0