[Parted-maintainers] Bug#788808: parted: incorrectly reads partition table, or crashes

A Mennucc debdev at mennucci.debian.net
Mon Jun 15 09:06:08 UTC 2015


Package: parted
Version: 3.2-7
Severity: important

Dear Maintainer,

the following bug happens when 'parted' tries to analyze to the image file
	https://www.olimex.com/wiki/images/b/b4/A20_OLinuxino_Micro_debian_34_90_release_10.torrent
that contains the operating system (Debian Wheezy) for the (quite remarkable) embedded system
	https://www.olimex.com/wiki/A20-OLinuXino-MICRO

The partition table of this image file cannot be properly read or
modified with parted. Older versions of parted crash on this image
file. Newer versions report a the partition table is dangerously
different from the real one, so an user that uses parted to change
partitions may destroy all the data.

As a comparison, see attachments fdisk.txt and cfdisk.txt to see what
the partizion table really looks like

The  attachment fdisk.txt was generated by the command
# echo p | fdisk  imagefile > /tmp/fdisk.txt
that was ran inside a Jessie-amd64 machine.

The  attachment cfdisk.txt was generated by the command
# cfdisk -P s /dev/mmcblk0
that was ran inside a the A20-OLinuXino-MICRO itself (since the 
Jessie version of cfdisk does not print partitions anymore (!!))

This bug is twofold 

------------ 

Using parted 3.2-7 (Debian jessie amd64) to read the above image file
seems to work, but the partition table is dangerously different from
the real one, so an user that uses parted to change partitions may
destroy all the data

See attachment parted.txt

----------

Using parted 2.3-12 (Debian wheezy, two archs) parted crashes by
    Assertion (head_size <= 63) 
(as in bug 685557)

See attachment crash....txt
---------

Best regards and thanks in advance.

	a.


-------------- next part --------------
Partition Table for /dev/mmcblk0

               First       Last
 # Type       Sector      Sector   Offset    Length   Filesystem Type (ID) Flag
-- ------- ----------- ----------- ------ ----------- -------------------- ----
   Pri/Log           0        2047      0#       2048 Free Space           None
 1 Primary        2048       34814*     0       32767*Linux (83)           None
   Pri/Log       34815*      34815      0           1*Free Space           None
 2 Primary       34816     7774207      0     7739392 Linux (83)           None
   Pri/Log     7774208    60874751      0    53100544 Free Space           None
-------------- next part --------------

Welcome to fdisk (util-linux 2.25.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): Disk imagefile: 3,7 GiB, 3980394496 bytes, 7774208 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x6f20736b

Device     Boot Start     End Sectors  Size Id Type
imagefile1       2048   34814   32767   16M 83 Linux
imagefile2      34816 7774207 7739392  3,7G 83 Linux


Command (m for help): 
-------------- next part --------------
Script started on lun 15 giu 2015 10:53:09 CEST
root at kytty:/mnt# parted imagefile
GNU Parted 3.2
Using /mnt/imagefile
Welcome to GNU Parted! Type 'help' to view a list of commands.

                                                                          
(parted) p
Model:  (file)
Disk /mnt/imagefile: 3980MB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Disk Flags: 

Number  Start  End     Size    File system  Flags
 1      0,00B  3980MB  3980MB  fat32


                                                                          
(parted) q
root at kytty:/mnt# exit

Script done on lun 15 giu 2015 10:53:20 CEST
-------------- next part --------------
Script started on lun 15 giu 2015 10:47:19 CEST
frivolo:/media/R2D2/olimex# parted imagefile
GNU Parted 2.3
Using /media/R2D2/olimex/imagefile
Welcome to GNU Parted! Type 'help' to view a list of commands.

                                                                          
(parted) p
Backtrace has 14 calls on stack:
  14: /lib/i386-linux-gnu/libparted.so.0(ped_assert+0x29) [0xb77072a9]
  13: /lib/i386-linux-gnu/libparted.so.0(+0x42acb) [0xb773cacb]
  12: /lib/i386-linux-gnu/libparted.so.0(+0x432e4) [0xb773d2e4]
  11: /lib/i386-linux-gnu/libparted.so.0(+0x4682f) [0xb774082f]
  10: /lib/i386-linux-gnu/libparted.so.0(+0x1180e) [0xb770b80e]
  9: /lib/i386-linux-gnu/libparted.so.0(ped_disk_add_partition+0x1d6) [0xb770ec56]
  8: /lib/i386-linux-gnu/libparted.so.0(+0x448c0) [0xb773e8c0]
  7: /lib/i386-linux-gnu/libparted.so.0(+0x462bf) [0xb77402bf]
  6: /lib/i386-linux-gnu/libparted.so.0(ped_disk_new+0x61) [0xb770f171]
  5: parted() [0x804e71b]
  4: parted(interactive_mode+0x116) [0x8056186]
  3: parted(main+0x1906) [0x804dd86]
  2: /lib/i386-linux-gnu/i686/cmov/libc.so.6(__libc_start_main+0xe6) [0xb754ce46]
  1: parted() [0x804de25]

                                                                          


You found a bug in GNU Parted! Here's what you have to do:

Don't panic! The bug has most likely not affected any of your data.
Help us to fix this bug by doing the following:

Check whether the bug has already been fixed by checking
the last version of GNU Parted that you can find at:

	http://ftp.gnu.org/gnu/parted/

Please check this version prior to bug reporting.

If this has not been fixed yet or if you don't know how to check,
please visit the GNU Parted website:

	http://www.gnu.org/software/parted

for further information.

Your report should contain the version of this release (2.3)
along with the error message below, the output of

	parted DEVICE unit co print unit s print

and the following history of commands you entered.
Also include any additional information about your setup you
consider important.

Assertion (head_size <= 63) at ../../../libparted/labels/dos.c:662 in function
probe_partition_for_geom() failed.

Annullato
frivolo:/media/R2D2/olimex# exit

Script done on lun 15 giu 2015 10:47:28 CEST
-------------- next part --------------
Script started on Mon 15 Jun 2015 08:49:28 AM UTC
]0;root at bilbo: ~root at bilbo:~# uname -a
Linux bilbo 3.4.90+ #11 SMP PREEMPT Wed Aug 20 08:20:32 EEST 2014 armv7l GNU/Linux
]0;root at bilbo: ~root at bilbo:~# parted /dev/mmcblk0
GNU Parted 2.3
Using /dev/mmcblk0
Welcome to GNU Parted! Type 'help' to view a list of commands.

                                                                          
(parted) p
Backtrace has 0 calls on stack:

                                                                          


You found a bug in GNU Parted! Here's what you have to do:

Don't panic! The bug has most likely not affected any of your data.
Help us to fix this bug by doing the following:

Check whether the bug has already been fixed by checking
the last version of GNU Parted that you can find at:

	http://ftp.gnu.org/gnu/parted/

Please check this version prior to bug reporting.

If this has not been fixed yet or if you don't know how to check,
please visit the GNU Parted website:

	http://www.gnu.org/software/parted

for further information.

Your report should contain the version of this release (2.3)
along with the error message below, the output of

	parted DEVICE unit co print unit s print

and the following history of commands you entered.
Also include any additional information about your setup you
consider important.

Assertion (head_size <= 63) at ../../../libparted/labels/dos.c:662 in function
probe_partition_for_geom() failed.

Aborted
]0;root at bilbo: ~root at bilbo:~# exit

Script done on Mon 15 Jun 2015 08:49:43 AM UTC


More information about the Parted-maintainers mailing list