]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
stand/common/disk.c: Read partition table relative to the start of the disk
authorallanjude <allanjude@FreeBSD.org>
Mon, 2 Jul 2018 18:19:08 +0000 (18:19 +0000)
committerallanjude <allanjude@FreeBSD.org>
Mon, 2 Jul 2018 18:19:08 +0000 (18:19 +0000)
commit1548e64fc6a11f3bc851e81d61eaeeb1dfc638e3
tree184d6a60e5dbe7eff08e5ec6a488eaa43ec34da6
parentb9b81e32655b9395e45f1f16e3774f6f38b5e933
stand/common/disk.c: Read partition table relative to the start of the disk

If a disk is of an oddball size, like the 200mb + 512b used in rootgen.sh,
when disk_open() is called on a GELI encrypted partition, attempts to read
the partition table fail, as they pass through the decryption process which
turns the already plaintext data into jibberish.

When reading the partition table, always pass a slice and partition setting
of -1, and an offset of 0. Setting the slice to -1 prevents a false
positive when checking the slice against the cache of GELI encrypted
slices.

Reviewed by: imp, ian
Sponsored by: Klara Systems
Differential Revision: https://reviews.freebsd.org/D15847
stand/common/disk.c