Bug 1022743 - mishandles corrupt primary GPT, doesn't use backup GPT
Summary: mishandles corrupt primary GPT, doesn't use backup GPT
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: grub2
Version: 20
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Peter Jones
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-10-23 22:35 UTC by Chris Murphy
Modified: 2015-06-29 12:42 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-06-29 12:42:21 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Chris Murphy 2013-10-23 22:35:15 UTC
Description of problem: When simulating a corrupt primary GPT table (zeroing LBA 2), GRUB fails to use the backup GPT and drops to a rescue prompt.


Version-Release number of selected component (if applicable):
grub2-2.00-25.fc20.x86_64

How reproducible:
Always for primary GPT table zeroing.
Never for backup GPT table zeroing.


Steps to Reproduce:
1. Start with a working kvm/qemu to qcow2 using GPT, with valid protective MBR and valid primary and backup GPTs.
2. "Corrupt" the primary GPT table by
dd if=/dev/zero of=/dev/vda seek=2 count=1
3. Reboot

Actual results:
error: no such partition.
Entering rescue mode ...


Expected results:
Clearly core.img is found and loaded, so it should be capable of evaluating the validity of the primary GPT and if invalid, then use the backup GPT.


Additional info:
If the alternate GPT table is zero'd in this manner, the system still boots. So it may be grub only uses the primary GPT, and this makes me wonder if it does a validity check of the primary GPT, or if it just blindly uses whatever's in the primary table; in which case actual corruption rather than zeroing may produce different results.

Also untested is zeroing/damaging either primary or backup GPT header instead of the table data.

Comment 1 Chris Murphy 2013-10-24 01:34:49 UTC
Tested altering only the partitiontypeguid for the primary header. GRUB now boots even though gdisk and parted and the kernel consider it corrupt.

So GRUB probably isn't checking for primary GPT validity, and if sufficiently corrupt or missing, won't use the backup GPT.

Comment 2 Chris Murphy 2013-10-24 01:40:33 UTC
I think this is the desired logical sequence:

Check if the MBR is a PMBR (1st and only entry is type 0xEE) and if not then consider the disk MBR and ignore any GPT info as stale. 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.

Comment 3 Fedora End Of Life 2015-05-29 09:37:28 UTC
This message is a reminder that Fedora 20 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 20. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '20'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 20 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 4 Fedora End Of Life 2015-06-29 12:42:21 UTC
Fedora 20 changed to end-of-life (EOL) status on 2015-06-23. Fedora 20 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.