From: Paul Moore <paul@paul-moore.com>
To: Bryam Vargas <hexlabsecurity@proton.me>,
Stephen Smalley <stephen.smalley.work@gmail.com>
Cc: linux-kernel@vger.kernel.org,
"Ondrej Mosnacek" <omosnace@redhat.com>,
"Kees Cook" <kees@kernel.org>,
selinux@vger.kernel.org,
"Christian Göttsche" <cgzones@googlemail.com>
Subject: Re: [PATCH 2/4] selinux: require a class's permission values to cover its permission count
Date: Mon, 03 Aug 2026 16:03:46 -0400 [thread overview]
Message-ID: <e56c9e8eccdade4c8ecd078412b0cada@paul-moore.com> (raw)
In-Reply-To: <20260731-b4-disp-d32e997b-v1-2-0341d038ee47@proton.me>
On Jul 31, 2026 Bryam Vargas <hexlabsecurity@proton.me> wrote:
>
> security_get_permissions() sizes an array by the class's permissions.nprim
> and fills it at value - 1, from the inherited common's permission table and
> then the class's own. A value no permission defines leaves a NULL that
> sel_make_perm_files() passes to d_alloc_name(), an oops inside
> sel_write_load() that strands selinux_state.policy_mutex and leaves every
> later load in uninterruptible sleep; two permissions sharing a value
> overwrite the first kstrdup(). Bounding each value by nprim catches
> neither, and neither would a count: the symbol table is keyed on the
> permission name, so duplicates pass.
>
> Track the values each permission table claims and require them to cover
> exactly what its count declares, rejecting a count no value can reach.
> Conforming policies are unaffected.
>
> Fixes: 55fcf09b3fe4 ("selinux: add support for querying object classes and permissions from the running policy")
> Cc: stable@vger.kernel.org
> Signed-off-by: Bryam Vargas <hexlabsecurity@proton.me>
> Acked-by: Stephen Smalley <stephen.smalley.work@gmail.com>
> ---
> security/selinux/ss/policydb.c | 51 +++++++++++++++++++++++++++++++++++++-----
> 1 file changed, 46 insertions(+), 5 deletions(-)
Merged into selinux/stable-7.2, thanks.
--
paul-moore.com
next prev parent reply other threads:[~2026-08-03 20:03 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-31 17:44 [PATCH 0/4] selinux: make declared counts account for the values Bryam Vargas via B4 Relay
2026-07-31 17:44 ` [PATCH 1/4] selinux: do not cancel a policy conversion that never started Bryam Vargas via B4 Relay
2026-07-31 19:40 ` Stephen Smalley
2026-08-03 20:03 ` Paul Moore
2026-07-31 17:44 ` [PATCH 2/4] selinux: require a class's permission values to cover its permission count Bryam Vargas via B4 Relay
2026-07-31 19:44 ` Stephen Smalley
2026-08-03 20:03 ` Paul Moore [this message]
2026-07-31 17:44 ` [PATCH 3/4] selinux: reject an unclaimed class value in security_get_classes() Bryam Vargas via B4 Relay
2026-07-31 19:46 ` Stephen Smalley
2026-08-03 20:03 ` Paul Moore
2026-07-31 17:44 ` [PATCH 4/4] selinux: require every boolean value to be defined Bryam Vargas via B4 Relay
2026-08-03 12:22 ` Stephen Smalley
2026-08-03 20:03 ` 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=e56c9e8eccdade4c8ecd078412b0cada@paul-moore.com \
--to=paul@paul-moore.com \
--cc=cgzones@googlemail.com \
--cc=hexlabsecurity@proton.me \
--cc=kees@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=omosnace@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox