Bug 1603 - Segfault in fstatfs testcase
Summary: Segfault in fstatfs testcase
Status: RESOLVED FIXED
Alias: None
Product: uClibc
Classification: Unclassified
Component: Standard Compliance (show other bugs)
Version: <= 0.9.29.x
Hardware: PC Linux
: P5 normal
Target Milestone: ---
Assignee: Bernhard Reutner-Fischer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-04-21 15:07 UTC by jwboyer
Modified: 2014-04-01 16:34 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments
testcase that segfaults (397 bytes, text/plain)
2010-04-21 15:08 UTC, jwboyer
Details
uClibc config file (4.38 KB, text/plain)
2010-04-21 15:10 UTC, jwboyer
Details

Note You need to log in before you can comment on or make changes to this bug.
Comment 1 jwboyer 2010-04-21 15:08:23 UTC
Created attachment 1537 [details]
testcase that segfaults

Compiled with:

uc_i686-linux-gcc -D_FILE_OFFSET_BITS=64 -o fstatfs fstatfs.c
Comment 2 jwboyer 2010-04-21 15:09:12 UTC
# gdb tmp/fstatfs 

warning: Can not parse XML syscalls information; XML support was disabled at compile time.
Copyright (C) 2009 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 "i686-linux".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /tmp/fstatfs...done.
(gdb) b fstatfs
Function "fstatfs" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y

Breakpoint 1 (fstatfs) pending.
(gdb) r
Starting program: /tmp/fstatfs 
Missing separate debuginfo for /lib/libgcc_s.so.1

Breakpoint 1, fstatfs (fd=-1, buf=0xbfffe9e8)
    at libc/sysdeps/linux/common/fstatfs.c:15
15      libc/sysdeps/linux/common/fstatfs.c: No such file or directory.
        in libc/sysdeps/linux/common/fstatfs.c
(gdb) c
Continuing.

Breakpoint 1, fstatfs (fd=1, buf=0xbfffe9e8)
    at libc/sysdeps/linux/common/fstatfs.c:15
15      in libc/sysdeps/linux/common/fstatfs.c
(gdb) c
Continuing.

Program received signal SIGSEGV, Segmentation fault.
0xb7fb3c56 in fstatfs64 (fd=1, buf=0xffffffff)
    at libc/misc/statfs/fstatfs64.c:40
40      libc/misc/statfs/fstatfs64.c: No such file or directory.
        in libc/misc/statfs/fstatfs64.c
(gdb) 
Comment 3 jwboyer 2010-04-21 15:09:40 UTC
# strace tmp/fstatfs 
execve("tmp/fstatfs", ["tmp/fstatfs"], [/* 22 vars */]) = 0
mmap2(NULL, 20, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7fea000
open("/lib/libgcc_s.so.1", O_RDONLY)    = 3
fstat(3, {st_mode=S_IFREG|0755, st_size=50572, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7fe9000
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0`\33\0\0004\0\0\0"..., 4096) = 4096
mmap2(NULL, 57344, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7fdb000
mmap2(0xb7fdb000, 46968, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 0) = 0xb7fdb000
mmap2(0xb7fe7000, 4248, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0xb) = 0xb7fe7000
close(3)                                = 0
munmap(0xb7fe9000, 4096)                = 0
open("/lib/libc.so.0", O_RDONLY)        = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=47737743, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7fe9000
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\200\311\0\0004\0\0\0"..., 4096) = 4096
mmap2(NULL, 393216, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7f7b000
mmap2(0xb7f7b000, 359472, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 0) = 0xb7f7b000
mmap2(0xb7fd4000, 5248, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x58) = 0xb7fd4000
mmap2(0xb7fd6000, 17204, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb7fd6000
close(3)                                = 0
munmap(0xb7fe9000, 4096)                = 0
open("/lib/libc.so.0", O_RDONLY)        = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=47737743, ...}) = 0
close(3)                                = 0
mprotect(0x8049000, 4096, PROT_READ)    = 0
mprotect(0xb7fe7000, 4096, PROT_READ)   = 0
mprotect(0xb7fd4000, 4096, PROT_READ)   = 0
mprotect(0xec9000, 4096, PROT_READ)     = 0
ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
ioctl(1, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
fstatfs(4294967295, 0xbfb46288)         = -1 EBADF (Bad file descriptor)
fstatfs(1, {f_type="DEVPTS_SUPER_MAGIC", f_bsize=4096, f_blocks=0, f_bfree=0, f_bavail=0, f_files=0, f_ffree=0, f_fsid={0, 0}, f_namelen=255, f_frsize=4096}) = 0
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++
# 
Comment 4 jwboyer 2010-04-21 15:10:37 UTC
Created attachment 1543 [details]
uClibc config file
Comment 5 Bernhard Reutner-Fischer 2014-04-01 16:34:56 UTC
This should be fixed on current master.