[parted-devel] [PATCH] libparted: reallocate buf after _disk_analyse_block_size call
jim at meyering.net
Thu Sep 6 17:01:29 UTC 2012
Brian C. Lane wrote:
> 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
> 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
Thanks for the added detail.
Would you please include something like that to the commit log
for your patch?
Re testing, would it be enough to use parted to create a MAC partition
table with "mklabel mac", add at least one partition, and then use dd or
perl to poke a new, larger number into its 16-bit big-endian
raw_disk->block_size field ?
More information about the parted-devel