From: sashiko-bot@kernel.org
Cc: selinux@vger.kernel.org
Subject: Re: [PATCH] selinux: treat genfscon lookup failure as non-fatal for booleans
Date: Tue, 08 Sep 2026 15:00:53 +0000 [thread overview]
Message-ID: <20260908150054.013DA1F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260908144341.17206-1-stephen.smalley.work@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The patch adds `ret = 0;` to prevent an error code from propagating, but it is a dead store because `ret` is unconditionally overwritten immediately afterward.
--
commit 56d806498916952baebbc4306bdac863b09cae9c
Author: Stephen Smalley <stephen.smalley.work@gmail.com>
selinux: treat genfscon lookup failure as non-fatal for booleans
This commit aims to make genfscon lookup failures non-fatal when labeling
inodes for policy booleans. It resets the error code from
selinux_policy_genfs_sid() to zero to prevent the error from propagating.
Link: https://lore.kernel.org/selinux/RvCmRlQYQ3uewSzEeY0utQ@coker.com.au/
> diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c
> index 5aaaf69410bb0..fb1d11e8fd371 100644
> --- a/security/selinux/selinuxfs.c
> +++ b/security/selinux/selinuxfs.c
> @@ -1278,6 +1278,7 @@ static int sel_make_bools(struct selinux_policy *newpolicy, struct dentry *bool_
> pr_warn_ratelimited("SELinux: no sid found, defaulting to security isid for %s\n",
> page);
> sid = SECINITSID_SECURITY;
> + ret = 0;
[Severity: Medium]
Is this assignment a dead store?
Looking at sel_make_bools(), ret is unconditionally overwritten just a few
lines later by the result of sel_attach_file():
isec->sid = sid;
isec->initialized = LABEL_INITIALIZED;
inode->i_fop = &sel_bool_ops;
inode->i_ino = i|SEL_BOOL_INO_OFFSET;
ret = sel_attach_file(bool_dir, names[i], inode);
Because ret is overwritten regardless of the prior error state, the added
assignment doesn't appear to change the functional behavior of the code.
The error code from selinux_policy_genfs_sid() was already being discarded
by the sel_attach_file() assignment before the loop condition could evaluate
it.
Does sel_attach_file() need to be skipped if selinux_policy_genfs_sid()
initially failed, or is there another way the error was intended to be
handled here?
> }
>
> isec->sid = sid;
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260908144341.17206-1-stephen.smalley.work@gmail.com?part=1
next prev parent reply other threads:[~2026-09-08 15:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-08 14:43 [PATCH] selinux: treat genfscon lookup failure as non-fatal for booleans Stephen Smalley
2026-09-08 15:00 ` sashiko-bot [this message]
2026-09-08 15:30 ` 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=20260908150054.013DA1F00A3A@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.