Bug 797979 - don't abort upon unexpected file system contents
Summary: don't abort upon unexpected file system contents
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: parted
Version: 6.2
Hardware: All
OS: Linux
Target Milestone: rc
: ---
Assignee: Brian Lane
QA Contact: Release Test Team
Depends On:
Blocks: 840685
TreeView+ depends on / blocked
Reported: 2012-02-27 17:37 UTC by Jim Meyering
Modified: 2013-03-13 20:41 UTC (History)
3 users (show)

Fixed In Version: parted-2.1-19.el6
Doc Type: Bug Fix
Doc Text:
Cause: Unexpected HFS+ filesystem contents Consequence: parted would crash Fix: Added a number of checks for unexpected values to the HFS+ code. Result: parted doesn't crash.
Clone Of:
Last Closed: 2013-02-21 10:13:31 UTC
Target Upstream Version:

Attachments (Terms of Use)
reduced image based on one from Chris Murphy (346 bytes, application/x-bzip2)
2012-02-27 17:37 UTC, Jim Meyering
no flags Details
new 'no abort' Apple Boot partition (394 bytes, application/x-bzip2)
2012-02-28 00:16 UTC, Chris Murphy
no flags Details

System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2013:0407 0 normal SHIPPED_LIVE parted bug fix and enhancement update 2013-02-20 20:50:39 UTC

Description Jim Meyering 2012-02-27 17:37:58 UTC
Created attachment 566113 [details]
reduced image based on one from Chris Murphy

Description of problem: probing (meaning any operation) could provoke failed assertion.

Version-Release number of selected component (if applicable): parted-2.1-18.el6.x86_64

How reproducible: every time

Steps to Reproduce:
1. parted -s AppleBoot.img u s p
Actual results: abort

Expected results: no abort

Additional info:
The original .img file was a 620MB monstrosity.
I found that with only the first and last 14KB of data
and with everything else zeroed out, it's still reproducible,
so created a sparse file like that which occupied only ~30KB.
GNU tar's --sparse option encodes that sensibly, so I've attached
an equivalent compressed tarball that occupies only just 4KiB.

backtrace, a little analysis and patch posted here:

Comment 1 Chris Murphy 2012-02-27 22:47:55 UTC
Only reproducible with the single example partition instance Jim attached. Through regression, I have been unable to produce an Apple Boot partition that causes an abort. The Apple Boot JHFS+ file system is clean per Apple's fsck_hfs utility, so I'm just not sure what's unique about this partition, but it does not seem to be common or likely to be encountered in the real world.

Further regression details here:

Comment 2 Chris Murphy 2012-02-28 00:16:43 UTC
Created attachment 566163 [details]
new 'no abort' Apple Boot partition

This is the resulting partition after regression steps followed, does not induce a parted crash. Unclear what the difference is between this and original.

Comment 3 Brian Lane 2012-06-05 17:48:30 UTC
patch from the list referenced in comment 1

--- ../libparted/fs/hfs/probe.c.~1~	2012-02-26 13:46:33.357842027 -0500
+++ ../libparted/fs/hfs/probe.c	2012-02-26 13:47:30.069592361 -0500
@@ -156,8 +156,9 @@
 		search = ((PedSector) PED_BE32_TO_CPU (vh->total_blocks) - 1)
 		      * ( PED_BE32_TO_CPU (vh->block_size) / PED_SECTOR_SIZE_DEFAULT )
 		      - 1;
-		if (!ped_geometry_set (geom_ret, geom_ret->start,
-					       search + 2)
+		if (search < 0
+		    || !ped_geometry_set (geom_ret, geom_ret->start,
+					  search + 2)
 		    || !ped_geometry_read (geom_ret, buf, search, 1)
 		    || vh->signature != PED_CPU_TO_BE16 (HFSP_SIGNATURE)) {
 		    	ped_geometry_destroy (geom_ret);

Comment 4 RHEL Program Management 2012-07-16 22:47:21 UTC
This request was evaluated by Red Hat Product Management for
inclusion in a Red Hat Enterprise Linux release.  Product
Management has requested further review of this request by
Red Hat Engineering, for potential inclusion in a Red Hat
Enterprise Linux release for currently deployed products.
This request is not yet committed for inclusion in a release.

Comment 6 Jan Stodola 2013-01-03 12:54:45 UTC
Reproduced with parted-2.1-18.el6:

[root@rtt7 ~]# parted -s AppleBoot.img u s p
Backtrace has 13 calls on stack:
  13: /lib64/libparted-2.1.so.0(ped_assert+0x32) [0x3fffd734316]
  12: /lib64/libparted-2.1.so.0(ped_geometry_read+0xc8) [0x3fffd73c5dc]
  11: /lib64/libparted-2.1.so.0(hfsplus_probe+0x1ae) [0x3fffd7574fa]
  10: /lib64/libparted-2.1.so.0(ped_file_system_probe_specific+0x7e) [0x3fffd735ba6]
  9: /lib64/libparted-2.1.so.0(ped_file_system_probe+0x82) [0x3fffd73611e]
  8: /lib64/libparted-2.1.so.0(+0x51614) [0x3fffd770614]
  7: /lib64/libparted-2.1.so.0(ped_disk_probe+0xbe) [0x3fffd73bb76]
  6: /lib64/libparted-2.1.so.0(ped_disk_new+0x40) [0x3fffd73bc1c]
  5: parted() [0x80007ac4]
  4: parted(non_interactive_mode+0xa2) [0x8000e02a]
  3: parted(main+0x7e) [0x8000c26e]
  2: /lib64/libc.so.6(__libc_start_main+0x120) [0x3fffd5138c4]
  1: parted() [0x80005e72]
Aborted (core dumped)
[root@rtt7 ~]#

Verified with parted-2.1-19.el6:

[root@rtt7 ~]# parted -s AppleBoot.img u s p
Error: /root/AppleBoot.img: unrecognised disk label
[root@rtt7 ~]#

Moving to VERIFIED.

Comment 8 errata-xmlrpc 2013-02-21 10:13:31 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.


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