From 452adee5b1138a9bb54d2404f714592b9ca62c8b Mon Sep 17 00:00:00 2001 From: krw Date: Sun, 13 Jun 2021 13:17:59 +0000 Subject: [PATCH] Back off a couple of the more paranoid checks while spoofing GPT partitions into the disklabel. First, since the alt header is never accessed there is no need to worry about it being inaccessible. Second, the GPT header claiming to cover more sectors than the device has is no reason to ignore all the partitions. The partition actually present could still be useful. Issues encountered in the wild by mlarkin@ while accessing some disk images. ok deraadt@ --- sys/kern/subr_disk.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/sys/kern/subr_disk.c b/sys/kern/subr_disk.c index 4e454aefec5..64ddf136069 100644 --- a/sys/kern/subr_disk.c +++ b/sys/kern/subr_disk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_disk.c,v 1.244 2021/06/02 22:44:27 krw Exp $ */ +/* $OpenBSD: subr_disk.c,v 1.245 2021/06/13 13:17:59 krw Exp $ */ /* $NetBSD: subr_disk.c,v 1.17 1996/03/16 23:17:08 christos Exp $ */ /* @@ -650,7 +650,6 @@ gpt_chk_hdr(struct gpt_header *gh, struct disklabel *lp) return (EINVAL); if (ghlbastart >= DL_GETDSIZE(lp) || - ghlbaend >= DL_GETDSIZE(lp) || ghpartlba >= DL_GETDSIZE(lp)) return (EINVAL); @@ -671,11 +670,6 @@ gpt_chk_hdr(struct gpt_header *gh, struct disklabel *lp) return (EINVAL); } - if (letoh64(gh->gh_lba_alt) >= DL_GETDSIZE(lp)) { - DPRINTF("alternate header's position is bogus\n"); - return (EINVAL); - } - return 0; } -- 2.20.1