bug-parted
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: GPT probe: signature vs checksum


From: Matt_Domsch
Subject: RE: GPT probe: signature vs checksum
Date: Fri, 30 Nov 2001 06:42:54 -0600

> On Fri, Nov 30, 2001 at 03:00:33PM +1100, Andrew Clausen wrote:
> > ANYway... the GPT probing code has the wrong semantics, IMHO.  It
> > is checking for a VALID gpt table, when it should merely be 
> searching
> > for a gpt table.  It should be checking signatures ONLY.  Not
> > checksums.  (And perhaps this 0xEE partition thing).
> 
> I should add:
> 
> There is a problem, that the signatures aren't enough to guarantee
> that you have a partition table (eg: the stale signature problem), and
> checksums can be used as a heuristic for making a better decision
> (perhaps... I'm yet to be convinced).
> 
> So, I propose something like:
> 
> int
> gpt_probe(...)
> {
>       if (!sigs_correct)
>               return 0;
> 
>       if (pmbr_ok) {
>               return 1;
>       } else {
>               ask, default to ok
>       }
> }
> 
> If the checksums are incorrect, then this should not be reason
> to believe there is no GPT table, but rather, the table is corrupt,
> and would you like to use the backup, sir?

I did it this way to follow the spec:

The following test must be performed to determine if a GUID Partition Table
is valid:
* Check the GUID Partition Table Signature
* Check the GUID Partition Table CRC
* Check that the MyLBA entry points to the LBA that contains the GUID
Partition Table
* Check the CRC of the GUID Partition Entry Array
If the GUID Partition Table is the primary table, stored at LBA 1:
* Check the AlternateLBA to see if it is a valid GUID Partition Table
If the primary GUID Partition Table is corrupt:
* Check the last LBA of the device to see if it has a valid GUID Partition
Table.
* If valid backup GUID Partition Table found, restore primary GUID Partition
Table.

If both the primary and backup GUID Partition Table is corrupted this block
device is defined as not having a
valid GUID Partition Header.


Then they're going to add the PMBR test too.  Yes, it's heavyweight for
probe, but I want to follow the spec (or work w/ Intel to change it like we
did the pmbr test).

If there are no sigs on the primary (or more generally, if anything about
the primary is wrong), we test the alternate.  If the alternate turns out
bad also, then something really doesn't want this disk to be gpt.

-Matt

-- 
Matt Domsch
Sr. Software Engineer
Dell Linux Solutions
www.dell.com/linux
#1 US Linux Server provider with 24% (IDC Sept 2001)
#2 Worldwide Linux Server provider with 17% (IDC Sept 2001)
#3 Unix provider with 18% in the US (Dataquest)!





reply via email to

[Prev in Thread] Current Thread [Next in Thread]