All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/1] dm-integrity: replace forgeable discard filler with a keyed sector marker
@ 2026-07-28 14:33 Shukai Ni
  2026-07-28 14:33 ` [PATCH v2 1/1] " Shukai Ni
  0 siblings, 1 reply; 4+ messages in thread
From: Shukai Ni @ 2026-07-28 14:33 UTC (permalink / raw)
  To: mpatocka, agk, snitzer
  Cc: 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.

v1 replaced the constant filler unconditionally 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.

v2 makes the fix opt-in instead. A new "allow_discards_keyed" target
argument enables the keyed marker. Once "allow_discards_keyed" is
used, SB_FLAG_DISCARD_KEYED is set in the superblock and persists
across future activations.

Changes since v1:
 - Added "allow_discards_keyed" as a new, explicit opt-in target
   argument instead of always replacing the discard marker scheme.
 - Added SB_FLAG_DISCARD_KEYED, a sticky superblock flag recording the
   choice, following the same persistence pattern as
   SB_FLAG_RECALCULATING.
 - Restored the original DISCARD_FILLER-based marker as the default
   behavior, so existing volumes are unaffected unless the admin
   explicitly opts in.
 - Documented the new option, its danger, and its formula in
   dm-integrity.rst; updated the status-string grammar in dm-ima.rst.

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

 .../admin-guide/device-mapper/dm-ima.rst      |   7 +-
 .../device-mapper/dm-integrity.rst            |  13 ++
 drivers/md/dm-integrity.c                     | 122 +++++++++++++++---
 3 files changed, 121 insertions(+), 21 deletions(-)

-- 
2.53.0


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

end of thread, other threads:[~2026-07-31 21:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-28 14:33 [PATCH v2 0/1] dm-integrity: replace forgeable discard filler with a keyed sector marker Shukai Ni
2026-07-28 14:33 ` [PATCH v2 1/1] " Shukai Ni
2026-07-30 15:29   ` Mikulas Patocka
2026-07-31 21:03     ` Milan Broz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.