[parted-devel] [PATCH] libparted: reallocate buf after _disk_analyse_block_size call
Brian C. Lane
bcl at redhat.com
Wed Sep 5 00:09:28 UTC 2012
On Tue, Sep 04, 2012 at 04:51:53PM -0700, Brian C. Lane wrote:
>
> I'm looking for comments on this quick test patch. The problem is this:
>
> In Fedora we have a hybrid iso that also contains a couple of EFI boot
> partitions in order to make it bootable on EFI systems and on Apple
> harware. Parted is sometimes throwing an error when they are written to
> a USB stick using dd and then examined with 'parted /dev/sdd p' or
> parted -l
>
> I think the right way to fix this is to reallocate the buf with the new
> size. The only other alternative I can see is to make
> __disk_analyse_block_size always return an error when there is a
> mismatch instead of prompting the user.
>
> I'm also not sure how we could write a good test case for this.
On re-reading that I realize I wasn't too clear as to what actually
happens. When it examines the USB it hits this warning in
_disk_analyse_block_size:
Warning: The driver descriptor says the physical block size is 2048
bytes, but Linux says it is 512 bytes.
If you tell it to ignore it will change the disk->dev->sector_size to
2048, then when it tries to read the ghost partitions in mac_read it
will overrun the buffer and clobber the heap, which results in the next
error causing a SIGSEGV as it tries to malloc space for the error
message.
--
Brian C. Lane | Anaconda Team | IRC: bcl #anaconda | Port Orchard, WA (PST8PDT)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 482 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/parted-devel/attachments/20120904/df7ab8ae/attachment.pgp>
More information about the parted-devel
mailing list