Bug 728949 - parted assert failure with malformed disk (zero-length partition)
parted assert failure with malformed disk (zero-length partition)
Status: CLOSED NEXTRELEASE
Product: Fedora
Classification: Fedora
Component: parted (Show other bugs)
rawhide
All Linux
high Severity high
: ---
: ---
Assigned To: Brian Lane
Fedora Extras Quality Assurance
:
: 734440 (view as bug list)
Depends On:
Blocks: F16Alphappc
  Show dependency treegraph
 
Reported: 2011-08-08 09:08 EDT by Richard W.M. Jones
Modified: 2012-03-14 09:06 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2011-10-11 14:41:11 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
test1.img.xz (15.13 KB, application/x-xz)
2011-08-08 12:37 EDT, Richard W.M. Jones
no flags Details
First few sectors of sda (17.00 KB, application/octet-stream)
2011-10-04 14:34 EDT, Mark Hamzy
no flags Details

  None (edit)
Description Richard W.M. Jones 2011-08-08 09:08:44 EDT
Description of problem:

Create a disk with a zero-length partition, eg run this command
as non-root:

$ guestfish -N disk -- \
  part-init /dev/sda mbr : \
  part-add /dev/sda p 1 8191 : \
  part-add /dev/sda p 8192 8192

The output is a disk image called "test1.img" in the
current directory.  Note that the second partition starts
and ends on the same sector, thus has zero length.

fdisk correctly interprets this disk image:

$ fdisk -l test1.img 

Disk test1.img: 104 MB, 104857600 bytes
255 heads, 63 sectors/track, 12 cylinders, total 204800 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
Disk identifier: 0x00029d91

    Device Boot      Start         End      Blocks   Id  System
test1.img1               1        8191        4095+  83  Linux
test1.img2            8192        8192           0+  83  Linux

The 'parted /dev/vda print' command fails with a stack trace
on this image:

$ parted test1.img print
WARNING: You are not superuser.  Watch out for permissions.
Backtrace has 14 calls on stack:
  14: /lib64/libparted.so.1(ped_assert+0x2e) [0x30c760d07e]
  13: /lib64/libparted.so.1(ped_geometry_read+0x80) [0x30c7613920]
  12: /lib64/libparted.so.1(ped_geometry_read_alloc+0x54) [0x30c76139b4]
  11: /lib64/libparted.so.1(nilfs2_probe+0x6a) [0x30c761ceea]
  10: /lib64/libparted.so.1(ped_file_system_probe_specific+0x53) [0x30c760e543]
  9: /lib64/libparted.so.1(ped_file_system_probe+0x4d) [0x30c760e61d]
  8: /lib64/libparted.so.1() [0x30c762080c]
  7: /lib64/libparted.so.1() [0x30c7621545]
  6: /lib64/libparted.so.1(ped_disk_new+0x58) [0x30c76125c8]
  5: parted() [0x4069c1]
  4: parted(non_interactive_mode+0x8c) [0x40ba6c]
  3: parted(main+0xe0f) [0x4059bf]
  2: /lib64/libc.so.6(__libc_start_main+0xed) [0x335c42150d]
  1: parted() [0x405a89]

I also checked and it fails in the same way if you attach the
disk image to a VM and run parted as root inside the VM.

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

parted-3.0-2.fc16.x86_64

How reproducible:

100%

Steps to Reproduce:
1. As above.
2.
3.
Comment 1 Brian Lane 2011-08-08 12:13:13 EDT
Was there an assertion print included with the traceback? It is calling ped_assert so it should be printing why along with the block of text about how to file a parted bug.
Comment 2 Richard W.M. Jones 2011-08-08 12:34:06 EDT
There was nothing else printed except what is above.

However I have compiled parted from git (99f9c6a), and here
is the full stack trace from gdb:

$ libtool --mode=execute gdb --args ./parted/parted /tmp/test1.img print
GNU gdb (GDB) Fedora (7.2.90.20110525-38.fc15)
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/rjones/d/parted/parted/.libs/lt-parted...done.
(gdb) run
Starting program: /home/rjones/d/parted/parted/.libs/lt-parted /tmp/test1.img print
warning: the debug information found in "/usr/lib/debug//lib64/libuuid.so.1.3.0.debug" does not match "/lib64/libuuid.so.1" (CRC mismatch).

warning: the debug information found in "/usr/lib/debug/lib64/libuuid.so.1.3.0.debug" does not match "/lib64/libuuid.so.1" (CRC mismatch).

warning: the debug information found in "/usr/lib/debug//lib64/libdevmapper.so.1.02.debug" does not match "/lib64/libdevmapper.so.1.02" (CRC mismatch).

warning: the debug information found in "/usr/lib/debug/lib64/libdevmapper.so.1.02.debug" does not match "/lib64/libdevmapper.so.1.02" (CRC mismatch).

warning: the debug information found in "/usr/lib/debug//lib64/libblkid.so.1.1.0.debug" does not match "/lib64/libblkid.so.1" (CRC mismatch).

warning: the debug information found in "/usr/lib/debug/lib64/libblkid.so.1.1.0.debug" does not match "/lib64/libblkid.so.1" (CRC mismatch).

[Thread debugging using libthread_db enabled]
WARNING: You are not superuser.  Watch out for permissions.
Backtrace has 14 calls on stack:
  14: /home/rjones/d/parted/libparted/.libs/libparted.so.1(ped_assert+0x2e) [0x7ffff7dbfe7e]
  13: /home/rjones/d/parted/libparted/.libs/libparted.so.1(ped_geometry_read+0x80) [0x7ffff7dc66c0]
  12: /home/rjones/d/parted/libparted/.libs/libparted.so.1(ped_geometry_read_alloc+0x54) [0x7ffff7dc6754]
  11: /home/rjones/d/parted/libparted/.libs/libparted.so.1(nilfs2_probe+0x6a) [0x7ffff7dcfa2a]
  10: /home/rjones/d/parted/libparted/.libs/libparted.so.1(ped_file_system_probe_specific+0x53) [0x7ffff7dc1323]
  9: /home/rjones/d/parted/libparted/.libs/libparted.so.1(ped_file_system_probe+0x4d) [0x7ffff7dc13fd]
  8: /home/rjones/d/parted/libparted/.libs/libparted.so.1(+0x207c4) [0x7ffff7dd37c4]
  7: /home/rjones/d/parted/libparted/.libs/libparted.so.1(+0x21035) [0x7ffff7dd4035]
  6: /home/rjones/d/parted/libparted/.libs/libparted.so.1(ped_disk_new+0x58) [0x7ffff7dc5368]
  5: /home/rjones/d/parted/parted/.libs/lt-parted() [0x4068e1]
  4: /home/rjones/d/parted/parted/.libs/lt-parted(non_interactive_mode+0x8c) [0x40b7fc]
  3: /home/rjones/d/parted/parted/.libs/lt-parted(main+0xe0f) [0x4058ef]
  2: /lib64/libc.so.6(__libc_start_main+0xed) [0x335c42150d]
  1: /home/rjones/d/parted/parted/.libs/lt-parted() [0x4059b5]

Program received signal SIGABRT, Aborted.
0x000000335c436305 in raise () from /lib64/libc.so.6
Missing separate debuginfos, use: debuginfo-install device-mapper-libs-1.02.65-3.fc16.x86_64 glibc-2.14.90-1.x86_64 libblkid-2.19.1-2.fc16.x86_64 libuuid-2.19.1-2.fc16.x86_64 ncurses-libs-5.9-2.20110716.fc16.x86_64
(gdb) bt
#0  0x000000335c436305 in raise () from /lib64/libc.so.6
#1  0x000000335c437c1b in abort () from /lib64/libc.so.6
#2  0x00007ffff7dbff31 in ped_assert (cond_text=0x7ffff7de711a "offset >= 0", 
    file=0x7ffff7de70f4 "cs/geom.c", line=295, 
    function=0x7ffff7de7340 "ped_geometry_read") at debug.c:111
#3  0x00007ffff7dc66c0 in ped_geometry_read (geom=<optimized out>, 
    buffer=<optimized out>, offset=<optimized out>, count=<optimized out>)
    at cs/geom.c:295
#4  0x00007ffff7dc6754 in ped_geometry_read_alloc (geom=0x634e68, 
    buffer=0x7fffffffdaf8, offset=-8, count=1) at cs/geom.c:316
#5  0x00007ffff7dcfa2a in nilfs2_probe (geom=0x634e68) at nilfs2.c:122
#6  0x00007ffff7dc1323 in ped_file_system_probe_specific (
    fs_type=0x7ffff7ff76e0, geom=0x634e68) at filesys.c:208
#7  0x00007ffff7dc13fd in ped_file_system_probe (geom=0x634e68)
    at filesys.c:278
#8  0x00007ffff7dd37c4 in read_table (disk=0x62c650, sector=0, 
    is_extended_table=0) at dos.c:1015
#9  0x00007ffff7dd4035 in msdos_read (disk=0x62c650) at dos.c:1071
#10 0x00007ffff7dc5368 in ped_disk_new (dev=0x62b740) at disk.c:199
#11 0x00000000004068e1 in do_print (dev=0x7fffffffdf48) at parted.c:944
#12 0x000000000040b7fc in non_interactive_mode (dev=0x7fffffffdf48, 
    cmd_list=<optimized out>, argc=<optimized out>, argv=0x7fffffffe078)
    at ui.c:1608
---Type <return> to continue, or q <return> to quit---
#13 0x00000000004058ef in main (argc=1, argv=0x7fffffffe078) at parted.c:1999
Comment 3 Richard W.M. Jones 2011-08-08 12:37:16 EDT
Created attachment 517264 [details]
test1.img.xz

Attached is the disk image which causes the error.  You will
have to uncompress it first using the 'unxz' command.
Comment 4 Brian Lane 2011-08-08 12:59:44 EDT
Thanks. Looks like the nilfs2_probe doesn't deal with partitions shorter than 8 blocks very well.
Comment 5 Brian Lane 2011-09-01 17:46:46 EDT
*** Bug 734440 has been marked as a duplicate of this bug. ***
Comment 6 Mark Hamzy 2011-10-04 14:09:06 EDT
I am seeing this as well:

[anaconda root@(none) root]# parted -l /dev/sda
Error: /dev/sda: unrecognised disk label
Model: AIX VDASD (scsi)
Disk /dev/sda: 32.2GB
Sector size (logical/physical): 512B/512B
Partition Table: unknown

Model: Linux device-mapper (snapshot) (dm)
Disk /dev/mapper/live-rw: 2147MB
Sector size (logical/physical): 512B/512B
Partition Table: loop

Number  Start  End     Size    File system  Flags
 1      0.00B  2147MB  2147MB  ext4


Warning: Unable to open /dev/sr0 read-write (Read-only file system).  /dev/sr0
has been opened read-only.
Warning: The driver descriptor says the physical block size is 512 bytes, but
Linux says it is 2048 bytes.
Ignore/Cancel? i
Backtrace has 13 calls on stack:
  13: /lib64/libparted.so.1(ped_assert-0x56d48) [0xfff9801b850]
  12: /lib64/libparted.so.1(ped_geometry_read-0x4e670) [0xfff98024908]
  11: /lib64/libparted.so.1(ped_geometry_read_alloc-0x4e5d0) [0xfff980249b8]
  10: /lib64/libparted.so.1(nilfs2_probe-0x43e84) [0xfff9802fb14]
  9: /lib64/libparted.so.1(ped_file_system_probe_specific-0x55154) [0xfff9801d6e4]
  8: /lib64/libparted.so.1(ped_file_system_probe-0x55064) [0xfff9801d7e4]
  7: /lib64/libparted.so.1(+0x3dd5c) [0xfff9803dd5c]
  6: /lib64/libparted.so.1(ped_disk_new-0x4fe90) [0xfff98022f48]
  5: parted() [0x100076a8]
  4: parted() [0x10008284]
  3: parted(main-0x2a9b0) [0x100061a0]
  2: /lib64/libc.so.6(+0x51ec8) [0xfff97db1ec8]
  1: /lib64/libc.so.6(__libc_start_main-0x16ebf4) [0xfff97db20bc]
Aborted (core dumped)

[anaconda root@(none) root]# fdisk -l /dev/sda

Disk /dev/sda: 32.2 GB, 32212254720 bytes
64 heads, 32 sectors/track, 30720 cylinders, total 62914560 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
Disk identifier: 0x00000000

Disk /dev/sda doesn't contain a valid partition table
Comment 7 Mark Hamzy 2011-10-04 14:28:00 EDT
[anaconda root@(none) root]# parted /dev/sda print
Error: /dev/sda: unrecognised disk label
Model: AIX VDASD (scsi)
Disk /dev/sda: 32.2GB
Sector size (logical/physical): 512B/512B
Partition Table: unknown
Comment 8 Mark Hamzy 2011-10-04 14:34:03 EDT
Created attachment 526297 [details]
First few sectors of sda

dd if=/dev/sda of=disk.img bs=512 count=34
Comment 9 Mark Hamzy 2011-10-04 16:30:29 EDT
The following kickstart file will certainly reproduce it.  It doesn't if the system has successfully installed during a previous manual install or not.

# Kickstart file automatically generated by anaconda.

#version=DEVEL
install
#cdrom
url --url=http://ppc.koji.fedoraproject.org/mash/16/ppc64/os/
lang en_US.UTF-8
keyboard us
network --onboot yes --device eth0 --bootproto=static --ip=9.5.250.145 --netmask=255.255.255.0 --gateway=9.5.250.1 --nameserver=9.10.244.100 --hostname=sharpie.rchland.ibm.com --noipv6
timezone --utc America/Chicago
rootpw  --iscrypted password
selinux --enforcing
authconfig --enableshadow --passalgo=sha512
firewall --service=ssh --service=http
# The following is the partition information you requested
# Note that any partitions you deleted are not expressed
# here so unless you clear all partitions first, this is
# not guaranteed to work

clearpart --all --drives=sda

part pv.008003 --grow --size=500
volgroup VolGroup --pesize=32768 pv.008003
logvol swap --name=lv_swap --vgname=VolGroup --grow --size=1024 --maxsize=6096
logvol / --fstype=ext4 --name=lv_root --vgname=VolGroup --grow --size=1024 --maxsize=51200
part /boot --fstype=ext4 --size=500
part prepboot --fstype=prepboot --size=4

bootloader --location=partition --timeout=5

%packages
@base
@core
%end
Comment 10 Brian Lane 2011-10-06 12:08:15 EDT
Could you give this scratch build a try?

http://koji.fedoraproject.org/koji/taskinfo?taskID=3409804
Comment 11 Mark Hamzy 2011-10-07 10:37:43 EDT
(In reply to comment #10)
> Could you give this scratch build a try?
> 
> http://koji.fedoraproject.org/koji/taskinfo?taskID=3409804

This works for us, Brian! Thanks.
Comment 12 Richard W.M. Jones 2011-10-11 11:03:27 EDT
I'm super-busy, but happy to go with comment 11's confirmation.
Even better if it works with the disk image in comment 3, which
is what I would do to test it anyway.
Comment 13 Fedora Update System 2011-10-11 14:31:37 EDT
parted-3.0-3.fc16 has been submitted as an update for Fedora 16.
https://admin.fedoraproject.org/updates/parted-3.0-3.fc16
Comment 14 Fedora Update System 2011-10-15 20:56:29 EDT
parted-3.0-3.fc16 has been pushed to the Fedora 16 stable repository.  If problems still persist, please make note of it in this bug report.

Note You need to log in before you can comment on or make changes to this bug.