]> 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>
Wed, 20 Mar 2024 14:27:09 +0000 (15:27 +0100)
commitb77dc0caaaf37cb07242966b4b5d8c8f3e07b4e5
tree4d1f9c08e6c3c062b3bbbc50080cc8c27eb55b39
parent4c5e1c9d17d9c42c0bdbc134dbd49f56bbb8fe3c
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]