mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/1] dm-integrity: replace forgeable discard filler with a keyed sector marker
@ 2026-07-27 13:48 Shukai Ni
  2026-07-27 13:48 ` [PATCH 1/1] " Shukai Ni
  0 siblings, 1 reply; 3+ messages in thread
From: Shukai Ni @ 2026-07-27 13:48 UTC (permalink / raw)
  To: agk, snitzer
  Cc: mpatocka, bmarzins, gmazyland, dm-devel, linux-kernel, Shukai Ni

dm-integrity's discard support has a keyless bypass. When a device is
opened with --allow-discards, dm_integrity_rw_tag() treats a stored
tag consisting entirely of the constant DISCARD_FILLER (0xf6) as
sufficient proof that the corresponding block was discarded, and
skips the keyed integrity check for it. That constant is public and
needs no key to reproduce, so anyone able to write raw sectors to the
backing device can stamp an arbitrary data block with an all-0xf6 tag and
have its contents served as if they had passed HMAC verification.

The exposure is limited to dm-integrity's standalone cryptographic
authentication mode: discard is only accepted when internal_hash is
configured, so the combined dm-crypt + dm-integrity AEAD setup, where
dm-crypt supplies the tags itself, is not affected.

The attached patch replaces the constant filler with a per-sector
keyed marker: HMAC_key(salt || sector). A real data tag is
HMAC_key(salt || sector || block); because its input always includes
the full block while the discard marker's never does, the two cannot
structurally collide, regardless of block content.

Shukai Ni (1):
  dm-integrity: replace forgeable discard filler with a keyed sector
    marker

 drivers/md/dm-integrity.c | 77 ++++++++++++++++++++++++++++-----------
 1 file changed, 56 insertions(+), 21 deletions(-)

--
2.53.0

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-07-27 16:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-27 13:48 [PATCH 0/1] dm-integrity: replace forgeable discard filler with a keyed sector marker Shukai Ni
2026-07-27 13:48 ` [PATCH 1/1] " Shukai Ni
2026-07-27 16:09   ` Mikulas Patocka

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®