From: sergeh@kernel.org
To: Stephen Smalley <stephen.smalley.work@gmail.com>
Cc: selinux@vger.kernel.org, paul@paul-moore.com, omosnace@redhat.com
Subject: Re: [RFC PATCH 05/44] netstate,selinux: create the selinux netlink socket per network namespace
Date: Mon, 27 Jan 2025 03:30:33 +0000 [thread overview]
Message-ID: <Z5b92VmV-tEM-MU-@lei> (raw)
In-Reply-To: <20250102164509.25606-6-stephen.smalley.work@gmail.com>
On Thu, Jan 02, 2025 at 11:44:30AM -0500, Stephen Smalley wrote:
> The selinux netlink socket is used to notify userspace of changes to
> the enforcing mode and policy reloads. At present, these notifications
> are always sent to the initial network namespace. In order to support
> multiple selinux namespaces, each with its own enforcing mode and
> policy, we need to create and use a separate selinux netlink socket
> for each network namespace.
>
> Without this change, a policy reload in a child selinux namespace
> causes a notification to be sent to processes in the init namespace
> with a sequence number that may be higher than the policy sequence
> number for that namespace. As a result, userspace AVC instances in
> the init namespace will then end up rejecting any further access
> vector results from its own security server instance due to the
> policy sequence number appearing to regress, which in turn causes
> all subsequent uncached access checks to fail. Similarly,
> without this change, changing enforcing mode in the child selinux
> namespace triggers a notification to all userspace AVC instances
> in the init namespace that will switch their enforcing modes.
>
> This change does alter SELinux behavior, since previously reloading
> policy or changing enforcing mode in a non-init network namespace would
> trigger a notification to processes in the init network namespace.
> However, this behavior is not being relied upon by existing userspace
> AFAICT and is arguably wrong regardless.
>
> This change presumes that one will always unshare the network namespace
> when unsharing a new selinux namespace (the reverse is not required).
> Otherwise, the same inconsistencies could arise between the notifications
> and the relevant policy. At present, nothing enforces this guarantee
> at the kernel level; it is left up to userspace (e.g. container runtimes).
> It is an open question as to whether this is a good idea or whether
> unsharing of the selinux namespace should automatically unshare the network
Is there any advantage to not enforcing that? Something useful it might
facilitate?
next prev parent reply other threads:[~2025-01-27 3:30 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-02 16:44 [RFC PATCH 00/44] SELinux namespace support Stephen Smalley
2025-01-02 16:44 ` [RFC PATCH 01/44] selinux: restore passing of selinux_state Stephen Smalley
2025-01-02 16:44 ` [RFC PATCH 02/44] selinux: introduce current_selinux_state Stephen Smalley
2025-01-02 16:44 ` [RFC PATCH 03/44] selinux: support multiple selinuxfs instances Stephen Smalley
2025-01-02 16:44 ` [RFC PATCH 04/44] selinux: dynamically allocate selinux namespace Stephen Smalley
2025-01-02 16:44 ` [RFC PATCH 05/44] netstate,selinux: create the selinux netlink socket per network namespace Stephen Smalley
2025-01-27 3:30 ` sergeh [this message]
2025-01-27 15:00 ` Stephen Smalley
2025-01-02 16:44 ` [RFC PATCH 06/44] selinux: support per-task/cred selinux namespace Stephen Smalley
2025-01-27 3:41 ` sergeh
2025-01-27 15:07 ` Stephen Smalley
2025-01-02 16:44 ` [RFC PATCH 07/44] selinux: introduce cred_selinux_state() and use it Stephen Smalley
2025-01-02 16:44 ` [RFC PATCH 08/44] selinux: add a selinuxfs interface to unshare selinux namespace Stephen Smalley
2025-01-02 16:44 ` [RFC PATCH 09/44] selinuxfs: restrict write operations to the same " Stephen Smalley
2025-01-02 16:44 ` [RFC PATCH 10/44] selinux: introduce a global SID table Stephen Smalley
2025-01-02 16:44 ` [RFC PATCH 11/44] selinux: wrap security server interfaces to use the " Stephen Smalley
2025-01-02 16:44 ` [RFC PATCH 12/44] selinux: update hook functions to use correct selinux namespace Stephen Smalley
2025-01-02 16:44 ` [RFC PATCH 13/44] selinux: introduce cred_task_has_perm() Stephen Smalley
2025-01-02 16:44 ` [RFC PATCH 14/44] selinux: introduce cred_has_extended_perms() Stephen Smalley
2025-01-02 16:44 ` [RFC PATCH 15/44] selinux: introduce cred_self_has_perm() Stephen Smalley
2025-01-02 16:44 ` [RFC PATCH 16/44] selinux: introduce cred_has_perm() Stephen Smalley
2025-01-02 16:44 ` [RFC PATCH 17/44] selinux: introduce cred_ssid_has_perm() and cred_other_has_perm() Stephen Smalley
2025-01-02 16:44 ` [RFC PATCH 18/44] selinux: introduce task_obj_perm() Stephen Smalley
2025-01-02 16:44 ` [RFC PATCH 19/44] selinux: fix selinux_lsm_getattr() check Stephen Smalley
2025-01-02 16:44 ` [RFC PATCH 20/44] selinux: update bprm hooks for selinux namespaces Stephen Smalley
2025-01-02 16:44 ` [RFC PATCH 21/44] selinux: add kerneldoc to new permission checking functions Stephen Smalley
2025-01-02 16:44 ` [RFC PATCH 22/44] selinux: convert selinux_file_send_sigiotask() to namespace-aware helper Stephen Smalley
2025-01-02 16:44 ` [RFC PATCH 23/44] selinux: rename cred_has_perm*() to cred_tsid_has_perm*() Stephen Smalley
2025-01-02 16:44 ` [RFC PATCH 24/44] selinux: convert additional checks to cred_ssid_has_perm() Stephen Smalley
2025-01-02 16:44 ` [RFC PATCH 25/44] selinux: introduce selinux_state_has_perm() Stephen Smalley
2025-01-02 16:44 ` [RFC PATCH 26/44] selinux: annotate selinuxfs permission checks Stephen Smalley
2025-01-02 16:44 ` [RFC PATCH 27/44] selinux: annotate process transition " Stephen Smalley
2025-01-02 16:44 ` [RFC PATCH 28/44] selinux: convert xfrm and netlabel " Stephen Smalley
2025-01-02 16:44 ` [RFC PATCH 29/44] selinux: switch selinux_lsm_setattr() checks to current namespace Stephen Smalley
2025-01-02 16:44 ` [RFC PATCH 30/44] selinux: add limits for SELinux namespaces Stephen Smalley
2025-01-02 16:44 ` [RFC PATCH 31/44] selinux: fix namespace creation Stephen Smalley
2025-01-02 16:44 ` [RFC PATCH 32/44] selinux: limit selinux netlink notifications to init namespace Stephen Smalley
2025-01-02 16:44 ` [RFC PATCH 33/44] selinux: refactor selinux_state_create() Stephen Smalley
2025-01-02 16:44 ` [RFC PATCH 34/44] selinux: make open_perms namespace-aware Stephen Smalley
2025-01-02 16:45 ` [RFC PATCH 35/44] selinux: split cred_ssid_has_perm() into two cases Stephen Smalley
2025-01-02 16:45 ` [RFC PATCH 36/44] selinux: set initial SID context for init to "kernel" in global SID table Stephen Smalley
2025-01-02 16:45 ` [RFC PATCH 37/44] selinux: disallow writes to /sys/fs/selinux/user in non-init namespaces Stephen Smalley
2025-01-02 16:45 ` [RFC PATCH 38/44] selinux: convert nlmsg_sock_has_extended_perms() to namespace-aware Stephen Smalley
2025-01-02 16:45 ` [RFC PATCH 39/44] selinux: defer inode init on current selinux state Stephen Smalley
2025-01-02 16:45 ` [RFC PATCH 40/44] selinux: init inode from nearest initialized namespace Stephen Smalley
2025-01-02 16:45 ` [RFC PATCH 41/44] selinux: allow userspace to detect non-init SELinux namespace Stephen Smalley
2025-01-02 16:45 ` [RFC PATCH 42/44] selinux: exempt creation of init SELinux namespace from limits Stephen Smalley
2025-01-02 16:45 ` [RFC PATCH 43/44] selinux: introduce a Kconfig option for SELinux namespaces Stephen Smalley
2025-01-02 16:45 ` [RFC PATCH 44/44] selinux: fix inode initialization when no namespace is initialized Stephen Smalley
2025-01-07 18:31 ` Stephen Smalley
2025-02-07 18:07 ` [RFC PATCH 00/44] SELinux namespace support Stephen Smalley
2025-02-07 19:56 ` Paul Moore
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=Z5b92VmV-tEM-MU-@lei \
--to=sergeh@kernel.org \
--cc=omosnace@redhat.com \
--cc=paul@paul-moore.com \
--cc=selinux@vger.kernel.org \
--cc=stephen.smalley.work@gmail.com \
/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.