Non-cached is_selinux_enabled() variant?
praiskup opened this issue · 1 comments
praiskup commented
Consider that the caller does chroot()
first, and then asks for is_selinux_enabled()
. The current implementation uses cached static variable values to report if SELinux is enabled, these values are initiated by the library constructor (before the caller has the chance to call chroot()
).
selinux/libselinux/src/enabled.c
Lines 11 to 21 in 82195e7
Lines 146 to 154 in 82195e7
The thing is that tools like useradd --root /some/chroot
need some API to detect that SELinux is disabled in the chroot for further logic.
cgzones commented
A call to fini_selinuxmnt(3)
should cause is_selinux_enabled(3)
to report disabled.