Bug 482894 - segfault in e4fsprogs stats if device is not opened
Summary: segfault in e4fsprogs stats if device is not opened
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: e4fsprogs
Version: 5.3
Hardware: All
OS: Linux
low
low
Target Milestone: rc
: ---
Assignee: Eric Sandeen
QA Contact: BaseOS QE
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-01-28 18:19 UTC by Andrew Hecox
Modified: 2009-09-02 10:03 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-09-02 10:03:49 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
check for open fs before referencing (516 bytes, patch)
2009-01-28 18:20 UTC, Andrew Hecox
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2009:1413 0 normal SHIPPED_LIVE e4fsprogs bug fix update 2009-09-01 13:32:34 UTC

Description Andrew Hecox 2009-01-28 18:19:50 UTC
the function do_show_super_stats in EL's e4fsprogs and upstream's e2fsprogs does not check to see there is an open file system before referencing current_fs, causing a segfault. 

do_features seems to behave better. Attached is a patch to check for an open fs before referencing the structure. Tested on RHEL 5.3.

## for example ##

# /sbin/debuge4fs
debuge4fs 1.41.1 (01-Sep-2008)
debuge4fs:  stats  
Segmentation fault

# gdb /sbin/debuge4fs
(gdb) run
...
debuge4fs:  features
features: Filesystem not open
debuge4fs:  stats /dev/sdb1

Program received signal SIGSEGV, Segmentation fault.
do_show_super_stats (argc=2, argv=0x104943d0) at debugfs.c:294
294             gdt_csum = EXT2_HAS_RO_COMPAT_FEATURE(current_fs->super,
(gdb)

## patched ## 

]# /sbin/debugfs
debugfs 1.39 (29-May-2006)
debugfs:  stats
stats: Filesystem not open
debugfs:

Comment 1 Andrew Hecox 2009-01-28 18:20:42 UTC
Created attachment 330267 [details]
check for open fs before referencing

Comment 2 Andrew Hecox 2009-01-28 18:21:44 UTC
I didn't check fedora's sources, I'd guess the issue is there too.

Comment 3 Eric Sandeen 2009-01-29 03:02:16 UTC
It appears that this is a regression:

[root@mythbox ~]# debugfs
debugfs 1.40.4 (31-Dec-2007)
debugfs:  stats
stats: Filesystem not open
debugfs:  

but:

[root@mythbox2 ~]# debugfs
sdebugfs 1.41.3 (12-Oct-2008)
debugfs:  stats
Segmentation fault

Thanks for the report Andrew!  Patch seems about right, I think this change:

commit 8fdf29117f922419bd5b3f741e5d554b1d5b8893
Author: Jose R. Santos <jrs.com>
Date:   Sun Oct 21 21:03:57 2007 -0500

    Make debugfs uninit block group aware

which added the:

+       gdt_csum = EXT2_HAS_RO_COMPAT_FEATURE(current_fs->super,
+                                             EXT4_FEATURE_RO_COMPAT_GDT_CSUM);

before the open fs check is what broke it.  Needs upstream fixing too.

-Eric

Comment 4 Andrew Hecox 2009-01-29 03:36:07 UTC
oh geez, I didn't even notice the check was later. ...lunch time patching. Thanks Eric.

Comment 5 Eric Sandeen 2009-01-29 22:47:12 UTC
I've sent a patch upstream & committed to rawhide so far.  Thanks Andrew!

Comment 6 Eric Sandeen 2009-02-13 20:31:56 UTC
s/b fixed in e2fsprogs-1.41.4-2.el5

Comment 11 errata-xmlrpc 2009-09-02 10:03:49 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2009-1413.html


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