]> git.ipfire.org Git - thirdparty/util-linux.git/commit
libblkid: Check offset in LUKS2 header
authorMilan Broz <gmazyland@gmail.com>
Fri, 16 Feb 2024 15:44:12 +0000 (16:44 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 19 Feb 2024 09:47:43 +0000 (10:47 +0100)
commitfe61e56cd3e7e90c657af042dfb9767ea90e3b37
treeabc82b3144886147fc8ceb6f28daa2355d9765ff
parentd8318d5961cedbe96e09f446268bd0f6562e54d8
libblkid: Check offset in LUKS2 header

LUKS2 binary header contains offset field that describes where
the header should be located.

If this offset is not correct, blkid should tread this header
as invalid.

This patch fixes problem when both swap and LUKS headers are
present (LUKS header was swapped out) and detected LUKS header
is at a wrong offset.
As LUKS has higher priority, it confuses detection.

Signed-off-by: Milan Broz <gmazyland@gmail.com>
(cherry picked from commit e49de00f4a22f91ec5af08d97e30a198cd64e00d)
libblkid/src/superblocks/luks.c
tests/expected/blkid/low-probe-swap-luks [new file with mode: 0644]
tests/ts/blkid/images-fs/swap-luks.img.xz [new file with mode: 0644]