util-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dave Reisner <d@falconindy.com>
To: util-linux@vger.kernel.org
Cc: grawity@gmail.com
Subject: [bug] incorrect GPT entry validation?
Date: Sat, 3 Nov 2012 14:35:11 -0400	[thread overview]
Message-ID: <20121103183511.GO482@rampage> (raw)

Hi,

A user reported problems with libblkid incorrectly reporting (or not
reporting) tags for some partitions on a GPT formatted disk. I was able
to reproduce it:

- created a 10G disk on a VM
- initialized it with GPT (using gdisk), created 5 entries
- formatted each of them with ext4

blkid correctly reads the first 2 entries on the disk, but then starts
reporting corrupted GPT entries (seen via LIBBLKID_DEBUG=0xffff):

https://dev.archlinux.org/~dreisner/blkid_bad.txt

It's interesting to note that blkid will _always_ read 2 entries before
reporting corruption, i.e.

# blkid -c /dev/null /dev/vdd{4,5,2}

This shows full info for /dev/vdd4 and /dev/vdd5, but nothing for
/dev/vdd2.

Commenting out the final crc validation in libblkid/src/partitions/gpt.c
and rebuilding lets blkid continue on and it happily prints everything:

https://dev.archlinux.org/~dreisner/blkid_no_validate.txt

Of course this is entirely wrong, but I'm not familiar at all with the
internals of libblkid or GPT to understand what's misbehaving.


As an aside, I was sadly unable to create the same layout using the
shiny new fdisk:

Command (m for help): g

Command (m for help): n
Partition number (1-128): 1
First sector (34-20971486, default 34):
Using default value 34
Last sector (34-20971486, default 20971486): 2G
Value out of range.
Last sector (34-20971486, default 20971486): +2G
Created partition 1

Command (m for help): n
Partition number (1-128): 2
First sector (4194305-20971486, default 4194305): +2G
Value out of range.
First sector (4194305-20971486, default 4194305): +1G
Value out of range.
First sector (4194305-20971486, default 4194305): +1M
Value out of range.

Cheers,
Dave

             reply	other threads:[~2012-11-03 18:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-03 18:35 Dave Reisner [this message]
2012-11-05  9:45 ` [bug] incorrect GPT entry validation? Karel Zak
2012-11-05 14:05   ` Mantas Mikulėnas
2012-11-21 14:53 ` Karel Zak

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=20121103183511.GO482@rampage \
    --to=d@falconindy.com \
    --cc=grawity@gmail.com \
    --cc=util-linux@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;
as well as URLs for NNTP newsgroup(s).