From: sashiko-bot@kernel.org
Cc: selinux@vger.kernel.org
Subject: Re: [PATCH] selinux: read the inode SID once in selinux_inode_permission()
Date: Sat, 05 Dec 2026 08:53:32 +0000 [thread overview]
Message-ID: <sashiko-outbox-251315@kernel.org> (raw)
In-Reply-To: <20261205084009.3099383-1-zhangjiayi1014@gmail.com>
> selinux_inode_permission() reads isec->sid without isec->lock. On an
> AVD cache miss it reads it three times: in task_avdcache_search(), for
> avc_has_perm_noaudit(), and in task_avdcache_update(), which stores it
> as the key of the new cache entry. If the SID changes between the
> second and the third read, the new entry pairs the new SID with the
> decision computed for the old SID.
>
> The SID of an inode in use changes when selinux_task_to_inode() stores
> the task's current SID in its /proc/<pid> inodes, which pid_revalidate()
> does on every lookup; when a directory is relabeled through setxattr;
> and when an invalidated label is reloaded. For example, task A walks
> through /proc/<pid> of task B while B executes a program with a domain
> transition, and a lookup of /proc/<pid> by another thread stores B's
> new SID between A's two reads. A's cache then holds the decision for
> B's old SID under B's new SID. /proc/<pid> is a directory, the only
> [ ... ]
>
> Fixes: 5d7ddc59b3d8 ("selinux: reduce path walk overhead")
> Reported-by: syzbot+3857e9743aa17a4cd369@syzkaller.appspotmail.com
> Closes: https://lore.kernel.org/all/6b118362.8e3793c5.1bab8b.1377.GAE@google.com/
> Signed-off-by: Jiayi Zhang <zhangjiayi1014@gmail.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261205084009.3099383-1-zhangjiayi1014@gmail.com?part=1
prev parent reply other threads:[~2026-12-05 8:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-05 8:40 [PATCH] selinux: read the inode SID once in selinux_inode_permission() Jiayi Zhang
2026-12-05 8:53 ` sashiko-bot [this message]
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=sashiko-outbox-251315@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.