Linux Security Modules development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Jarkko Sakkinen" <jarkko@kernel.org>,
	"David Howells" <dhowells@redhat.com>
Cc: keyrings@vger.kernel.org,
	"Linus Torvalds" <torvalds@linux-foundation.org>,
	"Eric Biggers" <ebiggers@kernel.org>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Thomas Graf" <tgraf@suug.ch>,
	"Herbert Xu" <herbert@gondor.apana.org.au>,
	"Paul Moore" <paul@paul-moore.com>,
	"James Morris" <jmorris@namei.org>,
	"Serge E. Hallyn" <serge@hallyn.com>,
	"open list:RHASHTABLE" <linux-crypto@vger.kernel.org>,
	"open list:SECURITY SUBSYSTEM"
	<linux-security-module@vger.kernel.org>
Subject: Re: [PATCH v3 5/6] KEYS: Replace assoc_array with rhashtable
Date: Sun, 25 Oct 2026 01:05:06 +0000	[thread overview]
Message-ID: <sashiko-outbox-183965@kernel.org> (raw)
In-Reply-To: <20261025001105.1824178-6-jarkko@kernel.org>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] keys: build failure in bpf_lookup_keyring() after removing struct key.keys
--

commit 65b3c94e1ad80dd7e23ce523a687b926fdca188c
Author: Jarkko Sakkinen <jarkko@kernel.org>

KEYS: Replace assoc_array with rhashtable

This commit replaces the associative array implementation in the keyring
subsystem with rhashtable and an RCU-protected list using keyring_index and
keyring_link structures.

> diff --git a/include/linux/key.h b/include/linux/key.h
> index 20ca43f5eab1f..597131e150186 100644
> --- a/include/linux/key.h
> +++ b/include/linux/key.h

[ ... ]

> @@ -271,7 +260,7 @@ struct key {
>  		struct {
>  			/* Keyring bits */
>  			struct list_head name_link;
> -			struct assoc_array keys;
> +			struct keyring_index __rcu *index;
>  		};
>  	};

[Severity: Low]
Does removing the keys member from struct key break the build in
kernel/bpf/keys.c when both keys and bpf syscall support are enabled?

While commit 99fefa08474b ("KEYS: Introduce keyring_is_empty()") converted
dm-verity and fs-verity to use keyring_is_empty(), bpf_lookup_keyring() in
kernel/bpf/keys.c still accesses bpf_keyring->keys.nr_leaves_on_tree:

kernel/bpf/keys.c:bpf_lookup_keyring() {
	struct bpf_key *bkey;

	if (!bpf_keyring)
		return NULL;
	if (!READ_ONCE(bpf_keyring->keys.nr_leaves_on_tree) ||
	    !READ_ONCE(bpf_keyring->restrict_link))
		return NULL;
	...
}

Should bpf_lookup_keyring() be updated to call keyring_is_empty(bpf_keyring)
instead?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261025001105.1824178-1-jarkko@kernel.org?part=5

  reply	other threads:[~2026-10-25  1:05 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20261025001105.1824178-1-jarkko@kernel.org>
2026-10-25  0:10 ` [PATCH v3 2/6] KEYS: Reject descriptions larger than KEY_MAX_DESC_SIZE Jarkko Sakkinen
2026-10-25  0:53   ` sashiko-bot
2026-10-25  0:10 ` [PATCH v3 3/6] KEYS: Verify the key identity in __key_unlink_begin Jarkko Sakkinen
2026-10-25  0:53   ` sashiko-bot
2026-10-25  0:10 ` [PATCH v3 4/6] KEYS: Introduce keyring_is_empty() Jarkko Sakkinen
2026-10-25  0:51   ` sashiko-bot
2026-10-25  0:10 ` [PATCH v3 5/6] KEYS: Replace assoc_array with rhashtable Jarkko Sakkinen
2026-10-25  1:05   ` sashiko-bot [this message]
2026-10-25  3:35     ` Jarkko Sakkinen

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-183965@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=dhowells@redhat.com \
    --cc=ebiggers@kernel.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=jarkko@kernel.org \
    --cc=jmorris@namei.org \
    --cc=keyrings@vger.kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=paul@paul-moore.com \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=serge@hallyn.com \
    --cc=tgraf@suug.ch \
    --cc=torvalds@linux-foundation.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox