From: Petr Lautrbach <plautrba@redhat.com>
To: selinux@vger.kernel.org
Subject: can't unmount /sys/fs/selinux
Date: Wed, 13 Jan 2021 22:44:09 +0100 [thread overview]
Message-ID: <87wnwga4wm.fsf@redhat.com> (raw)
Hi,
we have few tests which uses `umount /sys/fs/selinux` trick to check how
userspace works in SELinux "disabled" environment. But it's not possible
with the current master:
# umount /sys/fs/selinux
umount: /sys/fs/selinux: target is busy.
# lsof /sys/fs/selinux
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
systemd 1 root mem REG 0,21 0 19 /sys/fs/selinux/status
systemd 1 root 55r REG 0,21 0 19 /sys/fs/selinux/status
systemd-u 875 root mem REG 0,21 0 19 /sys/fs/selinux/status
systemd-u 875 root 6r REG 0,21 0 19 /sys/fs/selinux/status
dbus-brok 1116 dbus mem REG 0,21 0 19 /sys/fs/selinux/status
dbus-brok 1116 dbus 5r REG 0,21 0 19 /sys/fs/selinux/status
systemd-l 1134 root mem REG 0,21 0 19 /sys/fs/selinux/status
systemd-l 1134 root 4r REG 0,21 0 19 /sys/fs/selinux/status
systemd 1643 root mem REG 0,21 0 19 /sys/fs/selinux/status
systemd 1643 root 28r REG 0,21 0 19 /sys/fs/selinux/status
(sd-pam) 1645 root mem REG 0,21 0 19 /sys/fs/selinux/status
...
sshd 218874 root mem REG 0,21 0 19 /sys/fs/selinux/status
sshd 218874 root 3r REG 0,21 0 19 /sys/fs/selinux/status
sshd 218880 plautrba mem REG 0,21 0 19 /sys/fs/selinux/status
sshd 218880 plautrba 3r REG 0,21 0 19 /sys/fs/selinux/status
It seems to be caused by commit 05bdc03130d7 ("libselinux: use kernel
status page by default") which replaced avc_netlink_open() in
avc_init_internal() with selinux_status_open()
In case of sshd process, /sys/fs/selinux/status seems to be mapped by
selinux_check_access() which is called from pam_selinux and it's left
open as there's no selinux_status_close() in selinux_check_access().
The similar situations probably happen in systemd and dbus.
So is it expected? Is it a bug? Do we need to change other components so
that they would call selinux_status_close() when they use check access?
Petr
next reply other threads:[~2021-01-13 21:51 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-13 21:44 Petr Lautrbach [this message]
2021-01-13 22:09 ` can't unmount /sys/fs/selinux Stephen Smalley
2021-01-13 22:56 ` Petr Lautrbach
2021-01-14 14:21 ` Petr Lautrbach
2021-01-14 16:24 ` Stephen Smalley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87wnwga4wm.fsf@redhat.com \
--to=plautrba@redhat.com \
--cc=selinux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.