Subject: bug#35715: closed (Re: bug#35715: parted crashed when extended partition doesn't start on physical sector boundary)

From: [email-masked] (GNU bug Tracking System)
Date: Thu, 16 May 2019 18:06:02 +0000

Your bug report

#35715: parted crashed when extended partition doesn't start on physical sector boundary

which was filed against the parted package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
35715: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=35715
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#35715: parted crashed when extended partition doesn't start on physical sector boundary
From: Phillip Susi <[email-masked]>
To: Jens Schmidt <[email-masked]>
Cc: [email-masked]
Date: Thu, 16 May 2019 14:05:07 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

This has nothing to do with alignment; it is because your first and
second extended partitions have no space between them to hold the EBR.
This space has been required by parted always and in the past all other
partitioning tools were believed to honor this requirement, but for some
unknown reason, a few people every now and then somehow find another
partititiong tool that lays out their table this way and parted won't
accept it.

Jens Schmidt writes:

> Hello developer team.
>
> parted crashed when extended partition doesn't
> start on physical sector boundary.
>
> On my older laptop's HDD the extended partition isn't aligned to
> 4096 bytes boundary but to 512 bytes. This is not really a problem
> because extended partition has only one sector in size and the speed
> reduction due to unaligned partition is not likely to be noticeable.
>
> parted never should crash when reading such a partition table!
>
> Please fix ASAP because this bug is at least five years old and has
> many entries in Google search.
>
>
> Output of: 'parted /dev/sda unit co print unit s print'
> ------
> Backtrace has 14 calls on stack:
>   14: /lib/i386-linux-gnu/libparted.so.2(ped_assert+0x51) [0xb76cd471]
>   13: /lib/i386-linux-gnu/libparted.so.2(+0x2320a) [0xb76e820a]
>   12: /lib/i386-linux-gnu/libparted.so.2(+0xdaf8) [0xb76d2af8]
>   11: /lib/i386-linux-gnu/libparted.so.2(ped_disk_add_partition+0x2ac) [0xb76d34fc]
>   10: /lib/i386-linux-gnu/libparted.so.2(+0x22af7) [0xb76e7af7]
>   9: /lib/i386-linux-gnu/libparted.so.2(+0x22bee) [0xb76e7bee]
>   8: /lib/i386-linux-gnu/libparted.so.2(+0x22b30) [0xb76e7b30]
>   7: /lib/i386-linux-gnu/libparted.so.2(+0x23e60) [0xb76e8e60]
>   6: /lib/i386-linux-gnu/libparted.so.2(ped_disk_new+0x5b) [0xb76d30cb]
>   5: parted(+0x682b) [0x8007282b]
>   4: parted(non_interactive_mode+0x8f) [0x800780bf]
>   3: parted(main+0x10e3) [0x80070713]
>   2: /lib/i386-linux-gnu/libc.so.6(__libc_start_main+0xf6) [0xb74b8286]
>   1: parted(+0x489c) [0x8007089c]
>
> [..]
>
> Assertion (metadata_length > 0) at ../../../libparted/labels/dos.c:2313
> in function add_logical_part_metadata() failed.
> ------
>
>
> Output of: 'fdisk -l /dev/sda'
> ------------
> Disk /dev/sda: 931,5 GiB, 1000204886016 bytes, 1953525168 sectors
> Units: sectors of 1 * 512 = 512 bytes
> Sector size (logical/physical): 512 bytes / 4096 bytes
> I/O size (minimum/optimal): 4096 bytes / 4096 bytes
> Disklabel type: dos
> Disk identifier: 0xbfd1a1b9
>
> Device     Boot      Start        End    Sectors   Size Id Type
> /dev/sda1             2048     206847     204800   100M 83 Linux
> /dev/sda2  *        206848  335636479  335429632   160G  7 HPFS/NTFS/exFAT
> /dev/sda3        335636480  335699967      63488    31M ef EFI (FAT-12/16/32)
> /dev/sda4        335703422 1953524292 1617820871 771,4G  5 Extended
> /dev/sda5        335706112  339899775    4193664     2G 82 Linux swap / Solaris
> /dev/sda6        339899776  457083369  117183594  55,9G 83 Linux
> /dev/sda7        457085424  574269935  117184512  55,9G 83 Linux
> /dev/sda8        574271984 1530140671  955868688 455,8G 83 Linux
> /dev/sda9       1530142720 1851125759  320983040 153,1G 83 Linux
> /dev/sda10      1851127808 1953319492  102191685  48,7G 83 Linux
> /dev/sda11      1953323008 1953524292     201285  98,3M 83 Linux
> ------------
>
>
> Best regards
> Jens

Subject: parted crashed when extended partition doesn't start on physical sector boundary
From: Jens Schmidt <[email-masked]>
To: [email-masked]
Cc: [email-masked]
Date: Mon, 13 May 2019 16:23:15 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Hello developer team.

parted crashed when extended partition doesn't
start on physical sector boundary.

On my older laptop's HDD the extended partition isn't aligned to
4096 bytes boundary but to 512 bytes. This is not really a problem
because extended partition has only one sector in size and the speed
reduction due to unaligned partition is not likely to be noticeable.

parted never should crash when reading such a partition table!

Please fix ASAP because this bug is at least five years old and has
many entries in Google search.

Output of: 'parted /dev/sda unit co print unit s print'
------
Backtrace has 14 calls on stack:
  14: /lib/i386-linux-gnu/libparted.so.2(ped_assert+0x51) [0xb76cd471]
  13: /lib/i386-linux-gnu/libparted.so.2(+0x2320a) [0xb76e820a]
  12: /lib/i386-linux-gnu/libparted.so.2(+0xdaf8) [0xb76d2af8]
  11: /lib/i386-linux-gnu/libparted.so.2(ped_disk_add_partition+0x2ac) [0xb76d34fc]
  10: /lib/i386-linux-gnu/libparted.so.2(+0x22af7) [0xb76e7af7]
  9: /lib/i386-linux-gnu/libparted.so.2(+0x22bee) [0xb76e7bee]
  8: /lib/i386-linux-gnu/libparted.so.2(+0x22b30) [0xb76e7b30]
  7: /lib/i386-linux-gnu/libparted.so.2(+0x23e60) [0xb76e8e60]
  6: /lib/i386-linux-gnu/libparted.so.2(ped_disk_new+0x5b) [0xb76d30cb]
  5: parted(+0x682b) [0x8007282b]
  4: parted(non_interactive_mode+0x8f) [0x800780bf]
  3: parted(main+0x10e3) [0x80070713]
  2: /lib/i386-linux-gnu/libc.so.6(__libc_start_main+0xf6) [0xb74b8286]
  1: parted(+0x489c) [0x8007089c]

[..]

Assertion (metadata_length > 0) at ../../../libparted/labels/dos.c:2313
in function add_logical_part_metadata() failed.
------

Output of: 'fdisk -l /dev/sda'
------------
Disk /dev/sda: 931,5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0xbfd1a1b9

Device     Boot      Start        End    Sectors   Size Id Type
/dev/sda1             2048     206847     204800   100M 83 Linux
/dev/sda2  *        206848  335636479  335429632   160G  7 HPFS/NTFS/exFAT
/dev/sda3        335636480  335699967      63488    31M ef EFI (FAT-12/16/32)
/dev/sda4        335703422 1953524292 1617820871 771,4G  5 Extended
/dev/sda5        335706112  339899775    4193664     2G 82 Linux swap / Solaris
/dev/sda6        339899776  457083369  117183594  55,9G 83 Linux
/dev/sda7        457085424  574269935  117184512  55,9G 83 Linux
/dev/sda8        574271984 1530140671  955868688 455,8G 83 Linux
/dev/sda9       1530142720 1851125759  320983040 153,1G 83 Linux
/dev/sda10      1851127808 1953319492  102191685  48,7G 83 Linux
/dev/sda11      1953323008 1953524292     201285  98,3M 83 Linux
------------

Best regards
Jens