From: "Vladimir 'φ-coder/phcoder' Serbinenko" <phcoder@gmail.com>
To: grub-devel@gnu.org
Subject: Re: grub mishandles corrupt/missing primary GPT
Date: Thu, 24 Oct 2013 03:49:59 +0200 [thread overview]
Message-ID: <52687CC7.4010605@gmail.com> (raw)
In-Reply-To: <9DB3EF6D-6E26-4A9F-BB2D-07CCEF378D7A@colorremedies.com>
[-- Attachment #1: Type: text/plain, Size: 2030 bytes --]
On 24.10.2013 03:38, Chris Murphy wrote:
> https://bugzilla.redhat.com/show_bug.cgi?id=1022743
>
> Gist is, starting with a disk with valid PMBR, primary GPT, and backup
> GPT, if I zero LBA 2, I can no longer boot from the disk. I get a grub
> rescue prompt.
>
> Instead, if I merely corrupt a portion of the first partitiontypeguid to
> mimic corruption, I can still boot, whereas this primary GPT fails
> checksums with both gdisk and parted.
>
> This tells me that GRUB isn't checking for the validity of the primary
> GPT. And GRUB doesn't ever use the backup GPT.
>
> Expected behavior is GRUB should check if the MBR is a PMBR (1st and
> only entry is type 0xEE)
There are so called "hybrid" disks which we have to treat as GPT
> and if not then consider the disk MBR. If it is
> PMBR, check validity of the primary GPT header+table, if valid use it.
> If invalid, check validity of backup GPT header+table, if valid use it.
> If invalid, fail.
partmap module is size-critical and CRC32 verification is pretty big.
There are 3 problems with backup header:
1) Backup header would be preserved even when primary is deliberately
reformatted and if we use it then we'll use it even on disks where we
should use newly-created MBR
2) The disk size isn't always known (loopback over network device,
ieee1275 disks and CD-ROMs, possibly others)
3) There are some weird scenarios with USB enclosures "forgetting" last
disk sectors which leads to partition having two different back-headers.
Consider following scenario:
One formats with enclosure, then puts disk natively and moves backup
headers to real end of disk and later modifies partition table. Then
puts disk in enclosure again and then backup has older table.
Do you have ways to handle this?
Why primary would be corrupted in first place?
>
> Chris Murphy
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 291 bytes --]
next prev parent reply other threads:[~2013-10-24 1:50 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-24 1:38 grub mishandles corrupt/missing primary GPT Chris Murphy
2013-10-24 1:49 ` Vladimir 'φ-coder/phcoder' Serbinenko [this message]
2013-10-24 3:07 ` Chris Murphy
2013-10-24 13:39 ` Lennart Sorensen
2013-10-24 18:17 ` Chris Murphy
2013-11-02 22:36 ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-12-09 15:28 ` Phillip Susi
2013-12-09 15:54 ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-12-10 0:11 ` Chris Murphy
2013-12-10 0:55 ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-12-10 1:56 ` Chris Murphy
2013-12-10 2:06 ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-12-10 19:38 ` Phillip Susi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=52687CC7.4010605@gmail.com \
--to=phcoder@gmail.com \
--cc=grub-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).