From: Karel Zak <kzak@redhat.com>
To: Julius Werner <jwerner@chromium.org>
Cc: Davidlohr Bueso <dave@stgolabs.net>,
linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-block@vger.kernel.org,
Gwendal Grignou <gwendal@chromium.org>,
Doug Anderson <dianders@chromium.org>
Subject: Re: [PATCH] block: partitions: efi: Always check for alternative GPT at end of drive
Date: Tue, 26 Apr 2016 12:20:14 +0200 [thread overview]
Message-ID: <20160426102014.o7k77uzi32h73y3b@ws.net.home> (raw)
In-Reply-To: <1461632806-5946-1-git-send-email-jwerner@chromium.org>
On Mon, Apr 25, 2016 at 06:06:46PM -0700, Julius Werner wrote:
> The GUID Partiton Table layout maintains two synonymous partition tables
> on a block device, one starting in sector 1 and one in the very last
> sectors of the block device. This is useful if one of the tables gets
> accidentally corrupted (e.g. through a partial write because of an
> unexpected power loss).
>
> Linux normally only boots if the primary GPT is valid. It will not even
> try to find the alternative GPT to an invalid primary one unless the
> "gpt" command line option forces more aggressive detection. This doesn't
> really make any sense... if the "gpt" option is not set, the code
> validates the protective or hybrid MBR in sector 0 anyway before it even
> starts looking for the actual GPTs. If we get to the point where a valid
> proctective or hybrid MBR was found but the primary GPT was not found
> (valid), checking the alternative GPT is our best bet: we know that this
> block device is meant to use GPT (because any other partitioning system
> would've presumably overwritten sector 0), and we know that if the
> alternative GPT is valid it should contain more accurate information
> than parsing the protective/hybrid MBR with msdos_partition() would
> yield (which would otherwise be what happens next).
I guess "force_gpt" (and "gpt" on kernel command line) exists to force
users to think and care about a reason why the device has unreadable
(broken) primary GPT header.
It seems like bad (and dangerous) idea to silently ignore corrupted
primary GTP header and boot from such device.
And note that alternative GPT header and the end of the device is a
just guess. The proper location of the alternative header is specified
with-in primary header (pgpt->alternate_lba). The header at the end of
the device (as used for "force_gpt") is a fallback solution only.
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
next prev parent reply other threads:[~2016-04-26 10:20 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-26 1:06 Julius Werner
2016-04-26 10:20 ` Karel Zak [this message]
2016-04-26 18:33 ` Davidlohr Bueso
2016-04-26 20:13 ` Julius Werner
2016-04-26 20:34 ` Elliott, Robert (Persistent Memory)
2016-04-26 21:15 ` Davidlohr Bueso
2016-04-26 21:51 ` Gwendal Grignou
2016-04-27 15:09 ` Karel Zak
2016-04-27 15:45 ` Doug Anderson
2016-04-27 21:44 ` Julius Werner
2016-04-27 6:00 ` Ard Biesheuvel
2016-04-27 12:59 ` Austin S. Hemmelgarn
2016-04-26 14:38 ` Austin S. Hemmelgarn
2016-04-26 18:10 ` Davidlohr Bueso
2016-04-26 19:27 ` Austin S. Hemmelgarn
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=20160426102014.o7k77uzi32h73y3b@ws.net.home \
--to=kzak@redhat.com \
--cc=dave@stgolabs.net \
--cc=dianders@chromium.org \
--cc=gwendal@chromium.org \
--cc=jwerner@chromium.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.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
Powered by JetHome