From: Eric Biggers <ebiggers@kernel.org>
To: Mikulas Patocka <mpatocka@redhat.com>
Cc: Lorenz Kofler <lorenz@sigma-star.at>,
Mike Snitzer <snitzer@kernel.org>,
Benjamin Marzinski <bmarzins@redhat.com>,
Alasdair Kergon <agk@redhat.com>,
dm-devel@lists.linux.dev, linux-kernel@vger.kernel.org,
upstream+dm@sigma-star.at, David Howells <dhowells@redhat.com>,
Jarkko Sakkinen <jarkko@kernel.org>,
keyrings@vger.kernel.org
Subject: Re: [RFC PATCH 1/1] dm-integrity: support keys in the kernel keyring
Date: Fri, 2 Oct 2026 20:14:19 +0000 [thread overview]
Message-ID: <20261002201419.GA205250@google.com> (raw)
In-Reply-To: <1e53661e-42f4-72b2-3331-33af21e9fe0f@redhat.com>
On Fri, Oct 02, 2026 at 01:48:23PM +0200, Mikulas Patocka wrote:
> > > These four functions are copied from dm-crypt.c and dm-inlinecrypt.c.
> > > Copying code is generally malpattern, they should be unified and moved to
> > > an include file (that would be included in all three targets) or to the
> > > key management code (that would be called from all three targets).
> > >
> >
> > Yes that is the issue I described in the cover letters. But I don't
> > actually know which way is the preferred one. Afaik there are now
> > three options:
> >
> > 1. static inline helpers in a drivers/md header, so dm-crypt and
> > dm-integrity each compile their own copy
> > 2. a small library module, similar to dm-bufio, so there is one copy
> > that follows the value (y/m) of dm-crypt and dm-integrity
> > 3. integration into key management code
> >
> > Please tell me which option you prefer.
>
> Try 3, if not possible then 1. I think that introducing a module with this
> would be overkill.
>
> The "if (!strncmp(key_string, "logon:", key_desc - key_string + 1)) {"
> lines are duplicated as well, so I would refactor them and move them to
> the helper too.
>
> I don't know why dm-inlinecrypt only uses the "logon:" key while dm-crypt
> uses "user:", "encrypted:", "trusted:" as well (Eric - could you
> explain?). So, perhaps, dm-inlinecrypt could be extended to use all four
> key types as well.
The keyring support didn't exist in my version of the dm-inlinecrypt
patch. It seems to have been requested by Milan here:
https://lore.kernel.org/dm-devel/682506ea-c9c2-458b-8123-8d78fc53cc7f@gmail.com/
then added by Linlin.
From what I understand, the point of the keyring support in
dm-{crypt,inlinecrypt,integrity} is:
- To support "trusted" keys. But that is not what was actually
implemented in dm-inlinecrypt.
- To avoid having the key be readable with STATUSTYPE_TABLE. But that
is not what was actually implemented in dm-inlinecrypt. Keyrings are
also unnecesary to solve that problem.
- To cause security bugs such as https://lwn.net/Articles/1090568/ .
Since otherwise things aren't exciting enough, I guess.
Not sure what I'm missing.
But if you really do want to support all four key types in all three of
these targets anyway though, then sure, the code might as well be
shared since it would otherwise be the same code in each.
- Eric
next prev parent reply other threads:[~2026-10-02 20:14 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-28 6:27 [RFC PATCH 0/1] " Lorenz Kofler
2026-09-28 6:27 ` [RFC PATCH 1/1] " Lorenz Kofler
2026-09-30 15:00 ` Mikulas Patocka
2026-10-02 9:12 ` Lorenz Kofler
2026-10-02 11:48 ` Mikulas Patocka
2026-10-02 20:14 ` Eric Biggers [this message]
2026-10-02 21:09 ` Mikulas Patocka
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=20261002201419.GA205250@google.com \
--to=ebiggers@kernel.org \
--cc=agk@redhat.com \
--cc=bmarzins@redhat.com \
--cc=dhowells@redhat.com \
--cc=dm-devel@lists.linux.dev \
--cc=jarkko@kernel.org \
--cc=keyrings@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lorenz@sigma-star.at \
--cc=mpatocka@redhat.com \
--cc=snitzer@kernel.org \
--cc=upstream+dm@sigma-star.at \
/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®