Bug 1022217 - fdisk mishandles GPT corruption
fdisk mishandles GPT corruption
Product: Fedora
Classification: Fedora
Component: util-linux (Show other bugs)
Unspecified Unspecified
unspecified Severity urgent
: ---
: ---
Assigned To: Karel Zak
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2013-10-22 13:40 EDT by Chris Murphy
Modified: 2013-11-10 03:13 EST (History)
3 users (show)

See Also:
Fixed In Version: util-linux-2.24-1.fc20
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2013-11-10 03:13:46 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Chris Murphy 2013-10-22 13:40:34 EDT
Description of problem: When the primary GPT is corrupt and the backup GPT is valid, fdisk incorrectly considers the disklabel to be dos (MBR). When either primary or backup GPT is corrupt, fdisk incorrectly doesn't inform the user, and doesn't enable restoration of the invalid GPT with information from the valid one.

Marking this bug as urgent because the entire point of having two GPTs is precisely to avoid the problem described in this bug.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Use parted or gdisk to create a GPT partitioned disk.
2. Use dd to modify LBA 2.
3. Try to edit the disk with fdisk.

Actual results:
fdisk reports the disk label type is dos.

Expected results:
fdisk is required by the UEFI spec to use the valid GPT and restore the invalid GPT (using the correct information in the valid GPT).

Additional info:

Further, if LBA -33 is modified instead in step 2 above; fdisk correctly considers the disk gpt, but incorrectly fails to inform the user that the backup GPT is corrupt and offers no obvious means of restoring it.

Try to edit the disk with either parted or gdisk. They will notify which GPT is corrupt, and that the other is being used instead, and upon write will restore the invalid GPT.
Comment 1 Karel Zak 2013-10-23 04:55:01 EDT
Fixed by upstream commit d2d9efa103a744363bd000e075435341c5256c8a. Fedora package will be updated ASAP.
Comment 2 Karel Zak 2013-10-23 06:10:14 EDT
.. and commit upstream commit 45ddb828ed7eef92db34841c9d583047b6a6c65e.
Comment 3 Fedora Update System 2013-10-23 07:09:58 EDT
util-linux-2.24-1.fc20 has been submitted as an update for Fedora 20.
Comment 4 Fedora Update System 2013-10-23 13:31:55 EDT
Package util-linux-2.24-1.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing util-linux-2.24-1.fc20'
as soon as you are able to.
Please go to the following url:
then log in and leave karma (feedback).
Comment 5 Chris Murphy 2013-10-25 00:12:31 EDT
Separately zero'd LBA 2 and LBA -33. fdisk, like gdisk and parted, complains about corruption of the proper GPT, and upon writing out existing the problem is fixed.

Repeated the test with a one byte change to the partitiontypeGUID of the first partition. Same results, fdisk catches the corruption in the proper GPT and fixes either one.

Bug appears to be fixed.
Comment 6 Fedora Update System 2013-11-10 03:13:46 EST
util-linux-2.24-1.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.

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