From: sashiko-bot@kernel.org
Cc: linux-security-module@vger.kernel.org
Subject: Re: [PATCH] smack: Hold rcu_read_lock() for the IPv6 host label lookups
Date: Fri, 04 Dec 2026 19:27:03 +0000 [thread overview]
Message-ID: <sashiko-outbox-250538@kernel.org> (raw)
In-Reply-To: <20261204185112.1687982-1-praneethb2002@gmail.com>
Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [High] smack: missing rcu_read_lock() in smk_find_entry() [1]
--
commit 9573453fc6b675d33a1f2efa5ab515e7e7d7c7e2
Author: Praneeth Balasubramanian <praneethb2002@gmail.com>
smack: Hold rcu_read_lock() for the IPv6 host label lookups
This commit wraps process-context calls to smack_ipv6host_label() in
smk_ipv6_port_check(), smack_socket_connect(), and smack_socket_sendmsg()
with rcu_read_lock() and rcu_read_unlock().
> diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
> index 8e88ac65fd7fc..5329955a71402 100644
> --- a/security/smack/smack_lsm.c
> +++ b/security/smack/smack_lsm.c
> @@ -2855,6 +2855,7 @@ static int smk_ipv6_port_check(struct sock *sk, struct sockaddr_in6 *address,
> unsigned short port;
> struct smack_known *object;
>
> + rcu_read_lock();
> if (act == SMK_RECEIVING) {
> skp = smack_ipv6host_label(address);
> object = ssp->smk_in;
> @@ -2862,6 +2863,7 @@ static int smk_ipv6_port_check(struct sock *sk, struct sockaddr_in6 *address,
> skp = ssp->smk_out;
> object = smack_ipv6host_label(address);
> }
> + rcu_read_unlock();
[Severity: High]
This problem wasn't introduced by this patch, but does smk_find_entry()
have the same missing RCU read lock [1]?
security/smack/smack_access.c:smk_find_entry() {
...
hlist_for_each_entry_rcu(skp, head, smk_hashed)
if (strcmp(skp->smk_known, string) == 0)
return skp;
...
}
Callers such as smack_secctx_to_secid() in security/smack/smack_lsm.c
invoke smk_find_entry() without holding rcu_read_lock() or
smack_known_lock. smk_import_allocated_label() calls it under
smack_known_lock, but hlist_for_each_entry_rcu() has no lockdep condition.
With CONFIG_PROVE_RCU_LIST=y, traversing smack_known_hash this way
triggers the same lockdep warning about an RCU list walked outside a
reader section.
[1] https://sashiko.dev/#/bug/linux-29d4d0ee-96d6-4850-9369-f2bc7143c107
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261204185112.1687982-1-praneethb2002@gmail.com?part=1
prev parent reply other threads:[~2026-12-04 19:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 18:51 [PATCH] smack: Hold rcu_read_lock() for the IPv6 host label lookups Praneeth Balasubramanian
2026-12-04 19:27 ` 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-250538@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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