]> 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)
committerMilan Broz <gmazyland@gmail.com>
Fri, 16 Feb 2024 16:53:30 +0000 (17:53 +0100)
commite49de00f4a22f91ec5af08d97e30a198cd64e00d
tree273a8ddaf21a7fdc8339c73ec4fa6c3e8a69e593
parent9cb7b7671d903573d6c3b9d8112ec13953cdcdc6
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>
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]