mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jarkko Sakkinen <jarkko@kernel.org>
To: Andrew Halaney <andrew@amutable.com>
Cc: David Howells <dhowells@redhat.com>,
	Alasdair Kergon <agk@redhat.com>,
	Mike Snitzer <snitzer@kernel.org>,
	Mikulas Patocka <mpatocka@redhat.com>,
	Benjamin Marzinski <bmarzins@redhat.com>,
	Paul Moore <paul@paul-moore.com>,
	James Morris <jmorris@namei.org>,
	"Serge E. Hallyn" <serge@hallyn.com>,
	Eric Biggers <ebiggers@kernel.org>,
	"Theodore Y. Ts'o" <tytso@mit.edu>,
	Jonathan Corbet <corbet@lwn.net>,
	Shuah Khan <skhan@linuxfoundation.org>,
	Randy Dunlap <rdunlap@infradead.org>,
	dm-devel@lists.linux.dev, linux-kernel@vger.kernel.org,
	keyrings@vger.kernel.org, linux-security-module@vger.kernel.org,
	bpf@vger.kernel.org, fsverity@lists.linux.dev,
	linux-doc@vger.kernel.org,
	"Christian Brauner (Amutable)" <brauner@kernel.org>
Subject: Re: [PATCH 1/3] keys: add KEY_SPEC_DM_VERITY_KEYRING
Date: Fri, 25 Sep 2026 11:39:28 +0300	[thread overview]
Message-ID: <arYzQN1ViuiCBemo@kernel.org> (raw)
In-Reply-To: <aq2VxlttdlTNlHo6@toolbx>

On Fri, Sep 18, 2026 at 02:59:49PM -0500, Andrew Halaney wrote:
> On Fri, Sep 18, 2026 at 09:05:26AM +0100, David Howells wrote:
> > Jarkko Sakkinen <jarkko@kernel.org> wrote:
> > 
> > > This is great for discussion but what we want for the commit message
> > > is just motivation and resolution.
> > 
> > Actually, I think it's useful that Andrew wrote up the issues in the commit
> > message - and I think it shows part of the motivation.  The 'writing a fake
> > /proc/keys line in the description' is something I hadn't considered.
> 
> I'll defer to what you all want in the message here, I found it valuable
> but I trend on the side of overly verbose admittedly!
> 
> > 
> > > I don't think we need all this just to say that /proc/keys in a racy
> > > query mechanism for production, which is an issue for dm-verity, given
> > > that nothing else is available.
> > 
> > I think at some point, we will need a system call to search all for all
> > accessible keys matching certain criteria by actually walking the key
> > database.  The problem there is that there may be multiple hits, so we may
> > need something like:
> > 
> > 	int count = find_key(key_serial_t start_id,
> > 			     const char *type, const char *desc_prefix,
> > 			     key_serial_t *results, size_t results_size,
> > 			     unsigned int flags);
> > 
> > Allowing you to do:
> > 
> > 	key_serial_t dm_key;
> > 	int n = find_key(0, "keyring", ".dm_verity", &dm_key, 1,
> > 			 FIND_KEY_EXACT_DESC);
> > 
> > This wouldn't be as fast as a direct lookup since it would have to walk the
> > key tree, doing name comparisons and perm checks on each key of the type.
> > 
> > > And secondly special keys are meant for implicit keyrings so isn't
> > > that all there's to it?
> > 
> > I have no particular objection to setting aside a block of negative key IDs
> > for special keyrings that need to be accessed a lot - though I would make
> > common reg/unreg functions that take the ID to be registered and, say, set the
> > block at -257..-512.  Moving the BFP keyring to -257 and DM to -258.
> 
> To be clear are you suggesting I do that for v2 here? Happy to make the
> change and add some reuse to the registration functions, etc. I'm
> guessing its fine to change the bpf id since its still only in -next?
> 
> The only awkward bit with making that more generic is that dm-verity
> isn't __ro_after_init since its coming from a module possibly, and
> because of the module usage I also protected it with a spinlock in case
> someone's accessing it while you unload the module. Could just use one
> spinlock for the whole generic array, and drop the __ro_after_init I
> suppose.
> 
> Let me know if I'm not following properly!

I just read David's response and I think he made fair arguments,
and patches look fine to me.

David, did you have anything? I could pick these.

Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>

> 
> Thanks,
> Andrew


Br, Jarkko

  reply	other threads:[~2026-09-25  8:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-14 16:41 [PATCH 0/3] keys: Add well known IDs for fs-verity/dm-verity keys Andrew Halaney
2026-09-14 16:41 ` [PATCH 1/3] keys: add KEY_SPEC_DM_VERITY_KEYRING Andrew Halaney
2026-09-18  2:29   ` Jarkko Sakkinen
2026-09-18  8:05   ` David Howells
2026-09-18 19:59     ` Andrew Halaney
2026-09-25  8:39       ` Jarkko Sakkinen [this message]
2026-09-14 16:41 ` [PATCH 2/3] keys: add KEY_SPEC_FS_VERITY_KEYRING Andrew Halaney
2026-09-14 16:41 ` [PATCH 3/3] Documentation: keys: document IDs added since KEY_SPEC_REQKEY_AUTH_KEY Andrew Halaney
2026-09-15 12:39 ` [PATCH 0/3] keys: Add well known IDs for fs-verity/dm-verity keys Christian Brauner

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=arYzQN1ViuiCBemo@kernel.org \
    --to=jarkko@kernel.org \
    --cc=agk@redhat.com \
    --cc=andrew@amutable.com \
    --cc=bmarzins@redhat.com \
    --cc=bpf@vger.kernel.org \
    --cc=brauner@kernel.org \
    --cc=corbet@lwn.net \
    --cc=dhowells@redhat.com \
    --cc=dm-devel@lists.linux.dev \
    --cc=ebiggers@kernel.org \
    --cc=fsverity@lists.linux.dev \
    --cc=jmorris@namei.org \
    --cc=keyrings@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=mpatocka@redhat.com \
    --cc=paul@paul-moore.com \
    --cc=rdunlap@infradead.org \
    --cc=serge@hallyn.com \
    --cc=skhan@linuxfoundation.org \
    --cc=snitzer@kernel.org \
    --cc=tytso@mit.edu \
    /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

all inboxes | Powered by JetHome®