Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 406907

Summary: sys-fs/diskdev_cmds - fsck.hfsplus segfaults on amd64/hardened
Product: Gentoo Linux Reporter: nickrobbins
Component: [OLD] Core systemAssignee: No maintainer - Look at https://wiki.gentoo.org/wiki/Project:Proxy_Maintainers if you want to take care of it <maintainer-needed>
Status: UNCONFIRMED ---    
Severity: normal    
Priority: Normal    
Version: unspecified   
Hardware: AMD64   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on: 437398    
Bug Blocks:    
Attachments: emerge --info

Description nickrobbins 2012-03-04 18:06:11 UTC
Running fsck.hfsplus on a device produces a segfault. 

Reproducible: Always

Steps to Reproduce:
1.  # mkfs.hfsplus /dev/sdc1
Initialized /dev/sdc1 as a 100 MB HFS Plus volume
2. # fsck.hfsplus /dev/sdc1             
** /dev/sdc1
** Checking HFS Plus volume.
Segmentation fault

Actual Results:  
Not a segfault

Expected Results:  
segfault

This works on my non-hardened system.
Comment 1 nickrobbins 2012-03-04 18:08:00 UTC
Created attachment 304235 [details]
emerge --info
Comment 2 nickrobbins 2012-03-04 18:09:00 UTC
> Actual Results:  
> Not a segfault
> 
> Expected Results:  
> segfault
> 
> This works on my non-hardened system.

Of course, I have Actual and Expected switched.
Comment 3 Jeroen Roovers (RETIRED) gentoo-dev 2012-03-05 20:36:50 UTC
Do you have relevant dmesg output, and could you run it through gdb to get a proper backtrace?
Comment 4 nickrobbins 2012-03-05 21:58:56 UTC
(In reply to comment #3)
> Do you have relevant dmesg output, and could you run it through gdb to get a
> proper backtrace?

I'm new to this. But here is the line is dmesg:

[240364.497744]  fsck_hfs[16989]: segfault at 3b2cfe70 ip 000000603b07714b sp 000003fc2e415a50 error 6 in fsck_hfs[603b06d000+2f000]

and this is what I get following the procedure at http://www.gentoo.org/proj/en/qa/backtraces.xml

Starting program: /sbin/fsck_hfs /dev/sdc2
warning: no loadable sections found in added symbol-file system-supplied DSO at 0x36a4d8b1000

Program received signal SIGSEGV, Segmentation fault.
0x0000003016b1114b in CreateExtentsBTreeControlBlock (GPtr=<optimized out>) at SVerify1.c:786
786     SVerify1.c: No such file or directory.
        in SVerify1.c


As you can see from my emerge --info I had the system built with -fomit-frame-pointer. I removed that flag and added -ggdb and FEATURES=splitdebug. Then I rebuild diskdev_cmds and glibc before running gdb as above. Should I rebuild world and do it again?
Comment 5 nickrobbins 2012-03-26 22:41:48 UTC
Not sure what happened, but now it gives a different response in gdb:


 $ gdb /sbin/fsck_hfs
GNU gdb (Gentoo 7.3.1 p2) 7.3.1
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-pc-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.gentoo.org/>...
Reading symbols from /sbin/fsck_hfs...Reading symbols from /usr/lib64/debug/sbin/fsck_hfs.debug...done.
done.
(gdb) set logging file backtrace.log
(gdb) set logging on
Copying output to backtrace.log.
(gdb) set args local.disk
(gdb) run
Starting program: /sbin/fsck_hfs local.disk
** local.disk
** Checking HFS Plus volume.

Program received signal SIGSEGV, Segmentation fault.
0x000002aaaaab414b in CreateExtentsBTreeControlBlock (GPtr=<optimized out>) at SVerify1.c:786
786             ((BTreeExtensionsRec*)btcb->refCon)->BTCBMPtr = AllocateClearMemory(size);                      //      get precleared bitmap
(gdb) set logging off
Done logging to backtrace.log.
(gdb) quit
Comment 6 nickrobbins 2012-03-27 15:18:45 UTC
Ok, sorry for so many comments, but I'm learing about using gdb like this.

# gdb /sbin/fsck_hfs 
GNU gdb (Gentoo 7.3.1 p2) 7.3.1
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-pc-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.gentoo.org/>...
Reading symbols from /sbin/fsck_hfs...Reading symbols from /usr/lib64/debug/sbin/fsck_hfs.debug...done.
done.
(gdb) set logging file backtrace.log
(gdb) set logging on
Copying output to backtrace.log.
(gdb) set args /dev/sdb2
(gdb) run
Starting program: /sbin/fsck_hfs /dev/sdb2
warning: no loadable sections found in added symbol-file system-supplied DSO at 0x3fff7ffa000
** /dev/sdb2
** Checking HFS Plus volume.

Program received signal SIGSEGV, Segmentation fault.
0x000002aaaaab3280 in CreateExtentsBTreeControlBlock (GPtr=0x3ffffffc310) at SVerify1.c:786
786             ((BTreeExtensionsRec*)btcb->refCon)->BTCBMPtr = AllocateClearMemory(size);                      //      get precleared bitmap
(gdb) bt
#0  0x000002aaaaab3280 in CreateExtentsBTreeControlBlock (GPtr=0x3ffffffc310) at SVerify1.c:786
#1  0x000002aaaaab08f3 in ScavCtrl (GPtr=0x3ffffffc310, ScavOp=2, ScavRes=0x3ffffffc308) at SControl.c:391
#2  0x000002aaaaab0270 in CheckHFS (fsReadRef=8, fsWriteRef=9, checkLevel=2, repairLevel=2, logLevel=2, guiControl=0, 
    lostAndFoundMode=0, canWrite=1, modified=0x2aaaaceaea0) at SControl.c:145
#3  0x000002aaaaaad6c4 in checkfilesys (filesys=0x3ffffffdb8f "/dev/sdb2") at fsck_hfs.c:297
#4  0x000002aaaaaad475 in main (argc=0, argv=0x3ffffffd928) at fsck_hfs.c:191
(gdb) quit