Bug 482894 - segfault in e4fsprogs stats if device is not opened
segfault in e4fsprogs stats if device is not opened
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: e4fsprogs (Show other bugs)
5.3
All Linux
low Severity low
: rc
: ---
Assigned To: Eric Sandeen
BaseOS QE
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2009-01-28 13:19 EST by Andrew Hecox
Modified: 2009-09-02 06:03 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2009-09-02 06:03:49 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)
check for open fs before referencing (516 bytes, patch)
2009-01-28 13:20 EST, Andrew Hecox
no flags Details | Diff

  None (edit)
Description Andrew Hecox 2009-01-28 13:19:50 EST
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 13:20:42 EST
Created attachment 330267 [details]
check for open fs before referencing
Comment 2 Andrew Hecox 2009-01-28 13:21:44 EST
I didn't check fedora's sources, I'd guess the issue is there too.
Comment 3 Eric Sandeen 2009-01-28 22:02:16 EST
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@us.ibm.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-28 22:36:07 EST
oh geez, I didn't even notice the check was later. ...lunch time patching. Thanks Eric.
Comment 5 Eric Sandeen 2009-01-29 17:47:12 EST
I've sent a patch upstream & committed to rawhide so far.  Thanks Andrew!
Comment 6 Eric Sandeen 2009-02-13 15:31:56 EST
s/b fixed in e2fsprogs-1.41.4-2.el5
Comment 11 errata-xmlrpc 2009-09-02 06:03:49 EDT
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.