Bug 883224 - parted crashes when trying to print partition table
Summary: parted crashes when trying to print partition table
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Fedora
Classification: Fedora
Component: parted
Version: 17
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Brian Lane
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-12-04 04:41 UTC by Andrew Schultz
Modified: 2013-07-31 18:39 UTC (History)
1 user (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2013-07-31 18:39:27 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Andrew Schultz 2012-12-04 04:41:31 UTC
Description of problem:
parted crashes trying to print the partition table of a USB stick.  It complains first:

# parted /dev/sdb
GNU Parted 3.0
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Warning: The driver descriptor says the physical block size is 2048 bytes, but Linux says it is 512 bytes.
Ignore/Cancel? I

After I choose to ignore, it crashes ("You found a bug in GNU Parted! Here's what you have to do:...") but I get no stacktrace or assertion message.  valgrind says that it's writing to invalid memory:

Invalid write of size 8
   at 0x4A0A23B: memcpy@@GLIBC_2.14 (mc_replace_strmem.c:881)
   by 0x34E6616622: linux_read (string3.h:52)
   by 0x34E662846E: mac_read (mac.c:764)
   by 0x34E6612747: ped_disk_new (disk.c:199)
   by 0x406DB1: do_print (parted.c:984)
   by 0x40C192: interactive_mode (ui.c:1594)
   by 0x405CF5: main (parted.c:2107)
 Address 0x4c96160 is 0 bytes after a block of size 512 alloc'd
   at 0x4A0881C: malloc (vg_replace_malloc.c:270)
   by 0x34E660E8E5: ped_malloc (libparted.c:227)
   by 0x34E662A2F5: ptt_read_sectors (pt-tools.c:67)
   by 0x34E66281EB: mac_read (mac.c:738)
   by 0x34E6612747: ped_disk_new (disk.c:199)
   by 0x406DB1: do_print (parted.c:984)
   by 0x40C192: interactive_mode (ui.c:1594)
   by 0x405CF5: main (parted.c:2107)

string3.h appears to actually be an inlined memcpy call.  So valgrind is probably seeing linux_read at linux.c:1745.

My expectation was that the USB stick would have a Fedora 17 Install DVD image.

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

How reproducible:
every time

Comment 1 Brian Lane 2012-12-04 14:28:44 UTC
How did you make the USB stick? Was this a dd written iso?

Comment 2 Andrew Schultz 2012-12-04 14:37:37 UTC
Unfortunately, I don't recall entirely how I made the USB stick (it was a while ago; it might even be that I wrote something else to the stick since then).  fdisk complains that the partition table is GPT, which I wouldn't expect for a dd-written image.

Comment 3 Brian Lane 2012-12-04 18:08:37 UTC
Actually our iso's use hybridiso and can be booted on EFI and some Macs, so they look pretty odd to tools used to dealing with disks.

Comment 4 Andrew Schultz 2012-12-05 01:52:19 UTC
So... the buffer that linux_read has is 512 bytes (consistent with sector size from Linux).  But dev->sector_size is 2048 (consistent with the sector size from the driver descriptor).  The buffer is allocated before the sizes are checked and the warning printed.  It seems that it should reallocate the buffer to be 2048 or at least only pay attention to the first 512 bytes.

Comment 5 Andrew Schultz 2012-12-05 02:17:55 UTC
parted 3.1 seems to do just that.  mac.c (line 762) includes:

        /* re-allocate buf in case _disk_analyse_block_size changed
        * the sector_size */
        free (buf);
        buf = ped_malloc (disk->dev->sector_size);
        if (!buf)
                goto error;

please close as appropriate

Comment 6 Fedora End Of Life 2013-07-03 19:46:34 UTC
This message is a reminder that Fedora 17 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 17. 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 WONTFIX if it remains open with a Fedora 
'version' of '17'.

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 prior to Fedora 17's end of life.

Bug Reporter:  Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 17 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 to Fedora 17's end of life.

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 7 Fedora End Of Life 2013-07-31 18:39:34 UTC
Fedora 17 changed to end-of-life (EOL) status on 2013-07-30. Fedora 17 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.

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.