Re: [PATCH 2/4] selinux: require a class's permission values to cover its permission count
Stephen Smalley <[email protected]> Fri, 31 Jul 2026 15:44:06 -0400
| Newsgroups | org.kernel.vger.selinux,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <CAEjxPJ61_5ctF2OPRDS1fWeX1UapAF6iAn1DTY4RiySZswaqmw@mail.gmail.com> |
On Fri, Jul 31, 2026 at 1:44=E2=80=AFPM Bryam Vargas via B4 Relay <[email protected]> wrote: > > From: Bryam Vargas <[email protected]> > > security_get_permissions() sizes an array by the class's permissions.npri= m > and fills it at value - 1, from the inherited common's permission table a= nd > 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 an= d permissions from the running policy") > Cc: [email protected] > Signed-off-by: Bryam Vargas <[email protected]> Acked-by: Stephen Smalley <[email protected]>