From: sashiko-bot@kernel.org
Cc: selinux@vger.kernel.org
Subject: Re: [PATCH 1/4] selinux: do not cancel a policy conversion that never started
Date: Fri, 31 Jul 2026 17:58:54 +0000 [thread overview]
Message-ID: <20260731175855.59E621F00AC4@smtp.kernel.org> (raw)
In-Reply-To: <20260731-b4-disp-d32e997b-v1-1-0341d038ee47@proton.me>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Partial failure in `sel_make_policy_nodes()` fails to roll back the boolean directory swap, leaving selinuxfs in a corrupted torn state.
--
--- Patch [1]: [PATCH 1/4] selinux: do not cancel a policy conversion that never started ---
commit 60502da4772313c1b4e1e77b979bed50ee026bc3
Author: Bryam Vargas <hexlabsecurity@proton.me>
selinux: do not cancel a policy conversion that never started
This commit prevents a NULL pointer dereference in selinux_policy_cancel()
by checking if the old policy exists before attempting to cancel its
sidtab conversion. This handles the case where a first policy load fails
during selinuxfs tree creation.
> sel_write_load() calls selinux_policy_cancel() when sel_make_policy_nodes()
> fails, and that helper dereferences the outgoing policy to cancel its
> sidtab conversion.
[Severity: High]
This is a pre-existing issue, but looking at sel_make_policy_nodes() in
security/selinux/selinuxfs.c, if a partial failure occurs, could it leave
selinuxfs in a corrupted torn state?
If the class directory rename fails:
security/selinux/selinuxfs.c:sel_make_policy_nodes() {
...
/* classes */
ret = start_renaming_two_dentries(&rd, tmp_class_dir, fsi->class_dir);
if (ret)
goto out;
...
}
The function jumps to the error path after already committing the boolean
directory swap.
Is there a missing rollback for the VFS boolean directory swap and the
selinux_fs_info boolean array swaps on this error path?
Without a rollback, could reading or committing booleans via selinuxfs
operate on freed memory or scrambled indices since the old policy data is
freed in the cleanup path?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260731-b4-disp-d32e997b-v1-0-0341d038ee47@proton.me?part=1
next prev parent reply other threads:[~2026-07-31 17:58 UTC|newest]
Thread overview: 17+ 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 ` Bryam Vargas
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 17:44 ` Bryam Vargas
2026-07-31 17:58 ` sashiko-bot [this message]
2026-07-31 19:40 ` Stephen Smalley
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 17:44 ` Bryam Vargas
2026-07-31 17:50 ` sashiko-bot
2026-07-31 19:44 ` Stephen Smalley
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 17:44 ` Bryam Vargas
2026-07-31 18:03 ` sashiko-bot
2026-07-31 19:46 ` Stephen Smalley
2026-07-31 17:44 ` [PATCH 4/4] selinux: require every boolean value to be defined Bryam Vargas via B4 Relay
2026-07-31 17:44 ` Bryam Vargas
2026-07-31 18:01 ` sashiko-bot
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=20260731175855.59E621F00AC4@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--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.