Bug 1142421 - btrfs check subvol-extents segfault error 4 in libc-2.19.90.so
Summary: btrfs check subvol-extents segfault error 4 in libc-2.19.90.so
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: btrfs-progs
Version: 21
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Josef Bacik
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-09-16 17:57 UTC by Chris Murphy
Modified: 2015-12-02 16:17 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-12-02 03:51:02 UTC
Type: Bug


Attachments (Terms of Use)

Description Chris Murphy 2014-09-16 17:57:01 UTC
Description of problem: Using btrfs check --subvol-extents, I get a segfault.

Version-Release number of selected component (if applicable):
kernel-3.17.0-0.rc5.git0.1.fc22.x86_64
btrfs-progs-3.16-1.fc21.x86_64

How reproducible:
Always

Steps to Reproduce:
1. mkfs.btrfs /dev/sdc
2. btrfs check --subvol-extents /dev/sdc
3.

Actual results:

Segmentation fault (core dumped)

[  632.749774] btrfs[692]: segfault at 0 ip 00007fc9963fdd77 sp 00007fff93450880 error 4 in libc-2.19.90.so[7fc9963c2000+1bd000]


Expected results:

Not this.

Additional info:

# strace btrfs check --subvol-extents /dev/sdc
execve("/usr/sbin/btrfs", ["btrfs", "check", "--subvol-extents", "/dev/sdc"], [/* 26 vars */]) = 0
brk(0)                                  = 0x1913000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f17e1c41000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=86777, ...}) = 0
mmap(NULL, 86777, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f17e1c2b000
close(3)                                = 0
open("/lib64/libuuid.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0 \26\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=19984, ...}) = 0
mmap(NULL, 2113944, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f17e181a000
mprotect(0x7f17e181e000, 2093056, PROT_NONE) = 0
mmap(0x7f17e1a1d000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3000) = 0x7f17e1a1d000
close(3)                                = 0
open("/lib64/libblkid.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\360\210\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=264776, ...}) = 0
mmap(NULL, 2358184, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f17e15da000
mprotect(0x7f17e1615000, 2097152, PROT_NONE) = 0
mmap(0x7f17e1815000, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3b000) = 0x7f17e1815000
mmap(0x7f17e1819000, 2984, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f17e1819000
close(3)                                = 0
open("/lib64/libm.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\20V\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1167312, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f17e1c2a000
mmap(NULL, 3174760, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f17e12d2000
mprotect(0x7f17e13d9000, 2093056, PROT_NONE) = 0
mmap(0x7f17e15d8000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x106000) = 0x7f17e15d8000
close(3)                                = 0
open("/lib64/libz.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0\"\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=89992, ...}) = 0
mmap(NULL, 2183688, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f17e10bc000
mprotect(0x7f17e10d1000, 2093056, PROT_NONE) = 0
mmap(0x7f17e12d0000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x14000) = 0x7f17e12d0000
close(3)                                = 0
open("/lib64/liblzo2.so.2", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0&\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=138536, ...}) = 0
mmap(NULL, 2232552, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f17e0e9a000
mprotect(0x7f17e0ebb000, 2093056, PROT_NONE) = 0
mmap(0x7f17e10ba000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x20000) = 0x7f17e10ba000
close(3)                                = 0
open("/lib64/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\20a\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=146816, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f17e1c29000
mmap(NULL, 2213136, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f17e0c7d000
mprotect(0x7f17e0c95000, 2093056, PROT_NONE) = 0
mmap(0x7f17e0e94000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x17000) = 0x7f17e0e94000
mmap(0x7f17e0e96000, 13584, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f17e0e96000
close(3)                                = 0
open("/lib64/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0\2\2\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=2130240, ...}) = 0
mmap(NULL, 3960704, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f17e08b6000
mprotect(0x7f17e0a73000, 2097152, PROT_NONE) = 0
mmap(0x7f17e0c73000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1bd000) = 0x7f17e0c73000
mmap(0x7f17e0c79000, 16256, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f17e0c79000
close(3)                                = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f17e1c28000
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f17e1c26000
arch_prctl(ARCH_SET_FS, 0x7f17e1c26880) = 0
mprotect(0x7f17e0c73000, 16384, PROT_READ) = 0
mprotect(0x7f17e0e94000, 4096, PROT_READ) = 0
mprotect(0x7f17e10ba000, 4096, PROT_READ) = 0
mprotect(0x7f17e12d0000, 4096, PROT_READ) = 0
mprotect(0x7f17e15d8000, 4096, PROT_READ) = 0
mprotect(0x7f17e1a1d000, 4096, PROT_READ) = 0
mprotect(0x7f17e1815000, 12288, PROT_READ) = 0
mprotect(0x66a000, 12288, PROT_READ)    = 0
mprotect(0x7f17e1c42000, 4096, PROT_READ) = 0
munmap(0x7f17e1c2b000, 86777)           = 0
set_tid_address(0x7f17e1c26b50)         = 924
set_robust_list(0x7f17e1c26b60, 24)     = 0
rt_sigaction(SIGRTMIN, {0x7f17e0c82be0, [], SA_RESTORER|SA_SIGINFO, 0x7f17e0c8d7d0}, NULL, 8) = 0
rt_sigaction(SIGRT_1, {0x7f17e0c82c70, [], SA_RESTORER|SA_RESTART|SA_SIGINFO, 0x7f17e0c8d7d0}, NULL, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0
getrlimit(RLIMIT_STACK, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0} ---
+++ killed by SIGSEGV (core dumped) +++
Segmentation fault (core dumped)

Comment 1 Eric Sandeen 2014-09-16 18:28:51 UTC
I think that:

commit d34cbe76c723a05a14bbcfdc46e8ede789c3f1f9
Author: David Sterba <dsterba@suse.cz>
Date:   Fri Aug 22 16:01:38 2014 +0200

    btrfs-progs: check: do not require argument for --subvol-extents
    
    $ btrfs check --subvol-extents /dev/sdx
    ERROR: /dev/sdx is not a valid numeric value.
    
    Signed-off-by: David Sterba <dsterba@suse.cz>

broke this; it stopped requiring a subvol ID argument (which is what Mark had intended, I think) but still unconditionally does arg_strtou64(optarg) -> arg_strtou64(NULL) -> boom.

It's *supposed* to work like this:

./btrfs check --subvol-extents 256 /dev/sdc8
Print extent state for subvolume 256 on /dev/sdc8
UUID: 0425374d-fb74-4f74-bc2c-cfbe522a211d
Offset		Len	Root Refs	Roots
...

Of course it was never documented in the manpage, nor was a test ever written for the new functionality, so no surprise that there's confusion & breakage.

Chris, I'd just report this upstream, tbh.  I think kdave's patch should just be reverted, then docs & testcases written.

Comment 2 Fedora End Of Life 2015-11-04 15:09:37 UTC
This message is a reminder that Fedora 21 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 21. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '21'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 21 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 3 Fedora End Of Life 2015-12-02 03:51:04 UTC
Fedora 21 changed to end-of-life (EOL) status on 2015-12-01. Fedora 21 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


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