]> git.ipfire.org Git - thirdparty/util-linux.git/commit
libblkid: Ignore secondary LUKS2 header in blkid_do_safeprobe()
authorsilentcreek <silentcreek@users.noreply.github.com>
Sat, 4 Apr 2026 21:26:01 +0000 (21:26 +0000)
committersilentcreek <silentcreek@users.noreply.github.com>
Wed, 8 Apr 2026 13:27:13 +0000 (13:27 +0000)
commit3e60c1fe124dccd4e04d258ed7ff23f2d3ff4931
tree28efb46b1a1e9f2b5585b0aff38e2e36ee5704f5
parent699d086fa5f24651b375e5909c27e14a16ceb4b9
libblkid: Ignore secondary LUKS2 header in blkid_do_safeprobe()

The secondary LUKS2 header can match file data content on other
filesystems (e.g. an image file of a LUKS2 device stored on XFS whose
data blocks happen to land at device offsets where blkid looks for the
secondary LUKS2 header). This causes blkid to report a crypto_LUKS
superblock instead of the real filesystem.

Add a new flag BLKID_PROBE_FL_SAFEPROBE and skip scanning for the
secondary LUKS2 header in blkid_do_safeprobe(). The secondary LUKS2
header is only important for wipefs which uses a promiscuous probe.

Fixes: #4170
Fixes: 8bee1a2
Signed-off-by: Timo Sigurdsson <public_timo.s@silentcreek.de>
--
v2: Fix conflict with BLKID_FL_TINY_DEV flag
v3: Use pr->prob_flags instead of pr->flags
v4: Use original mask again as the use prob_flags resolves the conflict
libblkid/src/blkidP.h
libblkid/src/probe.c
libblkid/src/superblocks/luks.c