From: "Jan Sebastian Götte" <contact@jaseg.de>
To: "Milan Broz" <gmazyland@gmail.com>,
"Jan Sebastian Götte" <linux@jaseg.de>
Cc: kexec@lists.infradead.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org,
keyrings@vger.kernel.org, linux-doc@vger.kernel.org,
linux-security-module@vger.kernel.org,
linux-crypto@vger.kernel.org, linux-nvme@lists.infradead.org,
linux-nfs@vger.kernel.org, linux-integrity@vger.kernel.org,
linux-afs@lists.infradead.org, netdev@vger.kernel.org,
linux-fscrypt@vger.kernel.org, linux-fsdevel@vger.kernel.org,
dm-devel@lists.linux.dev,
Andrew Morton <akpm@linux-foundation.org>,
Baoquan He <baoquan.he@linux.dev>,
Mike Rapoport <rppt@kernel.org>,
Pasha Tatashin <pasha.tatashin@soleen.com>,
Pratyush Yadav <pratyush@kernel.org>,
Dave Young <ruirui.yang@linux.dev>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>,
David Howells <dhowells@redhat.com>,
Jarkko Sakkinen <jarkko@kernel.org>,
Jonathan Corbet <corbet@lwn.net>,
Shuah Khan <skhan@linuxfoundation.org>,
Paul Moore <paul@paul-moore.com>,
James Morris <jmorris@namei.org>,
"Serge E. Hallyn" <serge@hallyn.com>,
Lukas Wunner <lukas@wunner.de>, Ignat Korchagin <ignat@linux.win>,
Herbert Xu <herbert@gondor.apana.org.au>,
"David S. Miller" <davem@davemloft.net>,
Keith Busch <kbusch@kernel.org>, Jens Axboe <axboe@kernel.dk>,
Christoph Hellwig <hch@lst.de>, Sagi Grimberg <sagi@grimberg.me>,
Trond Myklebust <trondmy@kernel.org>,
Anna Schumaker <anna@kernel.org>,
Mimi Zohar <zohar@linux.ibm.com>,
James Bottomley <James.Bottomley@HansenPartnership.com>,
Marc Dionne <marc.dionne@auristor.com>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>,
Eric Biggers <ebiggers@kernel.org>,
"Theodore Y. Ts'o" <tytso@mit.edu>,
Jaegeuk Kim <jaegeuk@kernel.org>,
Alexander Viro <viro@zeniv.linux.org.uk>,
Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>,
Alasdair Kergon <agk@redhat.com>,
Mike Snitzer <snitzer@kernel.org>,
Mikulas Patocka <mpatocka@redhat.com>,
Benjamin Marzinski <bmarzins@redhat.com>
Subject: Re: [PATCH v2 13/13] dm crypt: wipe key material before kdump
Date: Wed, 12 Aug 2026 11:56:59 +0200 [thread overview]
Message-ID: <c5376b88-cc68-420a-ad8f-d494db9c7b1b@jaseg.de> (raw)
In-Reply-To: <8654c2d4-8d9d-43f5-9256-adf2915209e9@gmail.com>
On 8/11/26 22:18, Milan Broz wrote:
> On 8/11/26 7:53 PM, Jan Sebastian Götte wrote:
>> Wipe volume key/iv copies kept by dm-crypt with
>> CONFIG_CRASH_WIPE_SECRETS. The backend tfms are already handled
>> separately.
>>
>> Add a list tracking struct crypt_config instances when
>> CONFIG_CRASH_WIPE_SECRETS is set. Structs are tracked here to avoid
>> having to enumerate them through some roundabout way before kdump, when
>> we can't safely take locks anymore.
>
> Well, dm-crypt has crypt_wipe_key(), which can be called through a
> device-mapper message.
> It also sets keys to zero in the crypto API.
>
> Why do we need yet another way to wipe keys here, reimplementing
> everything twice?
>
> I can imagine an emergency wrapper callback that will suspend dm-crypt
> and call existing code.
I originally decided I'd keep these function separate since you can't
rely on memory allocation/freeing to work during panic. crypt_wipe_key
currently calls kfree_sensitive, and inside crypto_*_setkey there's also
kalloc/kfree calls hiding.
I could rework the patch to call into crypt_wipe_key, but I'd have to
make that avoid memory allocation/freeing. The direct kfree_sensitive
call can be replaced with a memzero_explicit, but I think I'd have to
add a dedicated "wipe without allocations" function to the crypto
backends as an alternative to setkey with a zero key.
>> Use custom wipe handlers even for things like ivs that have existing
>> wipe functions elsewhere because we need to use crash_wipe_memzero
>> instead of memzero_explicit. The crash_wipe helper memzero_explicit's
>> the target buffers and flushes data caches. On ARM64, missing that cache
>> flush could lead to the zeros not being written to DRAM before the kdump
>> code turns off the data caches moments later.
>
> Please no. It looks to me like you are trying to fix this on the wrong
> layer.
> This way everyone will need their own memzero...
You're probably right. I'll remove this from the next version and make
sure the caches are flushed properly during kexec instead.
> Dunno, but I really do not like dm-crypt becoming completely bloated
> with code
> that has nothing to do with the original purpose of this driver.
I feel like "delete key quick" is a pretty normal function for crypto code.
next prev parent reply other threads:[~2026-08-12 9:57 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-11 17:52 [PATCH v2 00/13] CRASH_WIPE_SECRETS: Wipe secrets before kdump (was: CRASH_ZEROIZE) Jan Sebastian Götte
2026-08-11 17:52 ` [PATCH v2 01/13] kexec: add CRASH_WIPE_SECRETS to wipe secrets before kdump Jan Sebastian Götte
2026-08-12 9:30 ` Baoquan He
2026-08-12 10:08 ` Jan Sebastian Götte
2026-08-16 12:13 ` Lukas Wunner
2026-08-17 7:38 ` Baoquan He
2026-08-17 8:25 ` Baoquan He
2026-08-18 9:03 ` Jan Sebastian Götte
2026-08-11 17:52 ` [PATCH v2 02/13] crash-core: Flush caches on CRASH_WIPE_SECRETS Jan Sebastian Götte
2026-08-11 17:52 ` [PATCH v2 03/13] arm64/mm: add set_direct_map_default_nosplit() Jan Sebastian Götte
2026-08-11 17:52 ` [PATCH v2 04/13] mm/secretmem: wipe secret pages before kdump Jan Sebastian Götte
2026-08-11 17:52 ` [PATCH v2 05/13] security/keys: wipe key payloads " Jan Sebastian Götte
2026-08-11 17:52 ` [PATCH v2 06/13] security/keys: implement wipe op for user-type keys Jan Sebastian Götte
2026-08-11 17:52 ` [PATCH v2 07/13] security/keys: implement wipe op for big_key Jan Sebastian Götte
2026-08-11 17:52 ` [PATCH v2 08/13] security/keys: implement wipe op for trusted and encrypted keys Jan Sebastian Götte
2026-08-11 17:52 ` [PATCH v2 09/13] security/keys: implement wipe op for asymmetric keys Jan Sebastian Götte
2026-08-11 17:52 ` [PATCH v2 10/13] rxrpc: implement wipe op for rxrpc keys Jan Sebastian Götte
2026-08-11 17:53 ` [PATCH v2 11/13] fscrypt: wipe master keys before kdump Jan Sebastian Götte
2026-08-11 17:53 ` [PATCH v2 12/13] crypto: api - wipe tfm contexts " Jan Sebastian Götte
2026-08-11 17:53 ` [PATCH v2 13/13] dm crypt: wipe key material " Jan Sebastian Götte
2026-08-11 20:18 ` Milan Broz
2026-08-12 9:56 ` Jan Sebastian Götte [this message]
2026-08-11 18:20 ` [PATCH v2 00/13] CRASH_WIPE_SECRETS: Wipe secrets before kdump (was: CRASH_ZEROIZE) Eric Biggers
2026-08-11 19:38 ` Jan Sebastian Götte
2026-08-11 20:41 ` Eric Biggers
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=c5376b88-cc68-420a-ad8f-d494db9c7b1b@jaseg.de \
--to=contact@jaseg.de \
--cc=James.Bottomley@HansenPartnership.com \
--cc=agk@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=anna@kernel.org \
--cc=axboe@kernel.dk \
--cc=baoquan.he@linux.dev \
--cc=bmarzins@redhat.com \
--cc=brauner@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=corbet@lwn.net \
--cc=davem@davemloft.net \
--cc=dhowells@redhat.com \
--cc=dm-devel@lists.linux.dev \
--cc=ebiggers@kernel.org \
--cc=edumazet@google.com \
--cc=gmazyland@gmail.com \
--cc=hch@lst.de \
--cc=herbert@gondor.apana.org.au \
--cc=horms@kernel.org \
--cc=ignat@linux.win \
--cc=jack@suse.cz \
--cc=jaegeuk@kernel.org \
--cc=jarkko@kernel.org \
--cc=jmorris@namei.org \
--cc=kbusch@kernel.org \
--cc=kexec@lists.infradead.org \
--cc=keyrings@vger.kernel.org \
--cc=kuba@kernel.org \
--cc=linux-afs@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-fscrypt@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-integrity@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-nfs@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=linux-security-module@vger.kernel.org \
--cc=linux@jaseg.de \
--cc=lukas@wunner.de \
--cc=marc.dionne@auristor.com \
--cc=mpatocka@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pasha.tatashin@soleen.com \
--cc=paul@paul-moore.com \
--cc=pratyush@kernel.org \
--cc=rppt@kernel.org \
--cc=ruirui.yang@linux.dev \
--cc=sagi@grimberg.me \
--cc=serge@hallyn.com \
--cc=skhan@linuxfoundation.org \
--cc=snitzer@kernel.org \
--cc=trondmy@kernel.org \
--cc=tytso@mit.edu \
--cc=viro@zeniv.linux.org.uk \
--cc=will@kernel.org \
--cc=zohar@linux.ibm.com \
/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