Patch "dm-integrity: replace forgeable discard filler with a keyed sector marker" has been added to the 6.12-stable tree
Subsystems (2)
Sasha Levin
AppliedThis is a note to let you know that I've just added the patch titled
dm-integrity: replace forgeable discard filler with a keyed sector marker
to the 6.12-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
dm-integrity-replace-forgeable-discard-filler-with-a.patch
and it can be found in the queue-6.12 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
commit 9a1885d62736654e9249541c43489258d07729ef
Author: Shukai Ni <[email protected]> Date: Tue Jul 28 16:33:50 2026 +0200
dm-integrity: replace forgeable discard filler with a keyed sector marker
[ Upstream commit 68c5c42567bc462139128968ebbfadd0aefff519 ]
The discard-block check in dm_integrity_rw_tag() treats a stored tag of all 0xf6 bytes (DISCARD_FILLER) as proof a block was discarded and skips HMAC verification. allow_discards is only accepted in dm-integrity's standalone mode. An attacker with raw write access to the backing device, but without the integrity key, can stamp any block with an all-0xf6 tag and have it served as authentic.
Add a new "allow_discards_keyed" target argument that marks discarded blocks with a keyed checksum of (salt || sector) instead, computed by integrity_discard_checksum().
Documentation/admin-guide/device-mapper/dm-ima.rst +5 -2
@@ -424,7 +424,8 @@ section above) has the following data format for 'integrity' target. target_attributes := <target_name> "," <target_version> "," <dev_name> "," <start> <tag_size> "," <mode> "," [<meta_device> ","] [<block_size> ","] <recalculate> "," - <allow_discards> "," <fix_padding> "," <fix_hmac> "," <legacy_recalculate> "," + <allow_discards> "," <allow_discards_keyed> "," <fix_padding> "," <fix_hmac> "," + <legacy_recalculate> "," <journal_sectors> "," <interleave_sectors> "," <buffer_sectors> ";" target_name := "target_name=integrity"
@@ -438,6 +439,7 @@ section above) has the following data format for 'integrity' target. block_size := "block_size=" <N> recalculate := "recalculate=" <yes_no> allow_discards := "allow_discards=" <yes_no> + allow_discards_keyed := "allow_discards_keyed=" <yes_no> fix_padding := "fix_padding=" <yes_no> fix_hmac := "fix_hmac=" <yes_no> legacy_recalculate := "legacy_recalculate=" <yes_no>
@@ -455,7 +457,8 @@ section above) has the following data format for 'integrity' target. dm_version=4.45.0; name=integrity1,uuid=,major=253,minor=1,minor_count=1,num_targets=1; target_index=0,target_begin=0,target_len=7856,target_name=integrity,target_version=1.10.0, - dev_name=253:0,start=0,tag_size=32,mode=J,recalculate=n,allow_discards=n,fix_padding=n, + dev_name=253:0,start=0,tag_size=32,mode=J,recalculate=n,allow_discards=n, + allow_discards_keyed=n,fix_padding=n, fix_hmac=n,legacy_recalculate=n,journal_sectors=88,interleave_sectors=32768,buffer_sectors=128;
Documentation/admin-guide/device-mapper/dm-integrity.rst +13 -0
@@ -185,6 +185,19 @@ allow_discards Allow block discard requests (a.k.a. TRIM) for the integrity device. Discards are only allowed to devices using internal hash. + A discarded block is marked with a constant filler tag that anyone + with raw write access to the backing device can forge without the + key. Use allow_discards_keyed instead on new volumes. + +allow_discards_keyed + Like allow_discards, but marks a discarded block with a keyed + checksum of the sector number, HMAC_key(salt || sector), instead of + the constant filler tag, so it can't be forged without the + integrity key. + + Not compatible with volumes that already have discarded blocks + marked the old way; only use on a freshly formatted volume. + fix_padding Use a smaller padding of the tag area that is more space-efficient. If this option is not present, large padding is
drivers/md/dm-integrity.c +96 -14
243 lines not on this page · raw message