Bug 1060204

Summary: [abrt] btrfs-progs: btrfs_super_csum_size(): btrfs-show-super killed by SIGABRT
Product: [Fedora] Fedora Reporter: Garry T. Williams <gtwilliams>
Component: btrfs-progsAssignee: Eric Sandeen <esandeen>
Status: CLOSED UPSTREAM QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 20CC: esandeen, josef, mmahut
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
URL: https://retrace.fedoraproject.org/faf/reports/bthash/33032c7282817bf9649cc86fa2b4a33bf10d9356
Whiteboard: abrt_hash:e6e6cb20615968ddf002365f0d1a0cba84a29320
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-06-17 02:27:10 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
File: backtrace
none
File: cgroup
none
File: core_backtrace
none
File: dso_list
none
File: environ
none
File: limits
none
File: maps
none
File: open_fds
none
File: proc_pid_status
none
File: var_log_messages none

Description Garry T. Williams 2014-01-31 13:01:56 UTC
Description of problem:
btrfs-show-super -a /dev/<not-btrfs>

Version-Release number of selected component:
btrfs-progs-3.12-1.fc20

Additional info:
reporter:       libreport-2.1.11
backtrace_rating: 4
cmdline:        btrfs-show-super -a /dev/sda1
crash_function: btrfs_super_csum_size
executable:     /usr/sbin/btrfs-show-super
kernel:         3.12.8-300.fc20.x86_64
runlevel:       N 5
type:           CCpp
uid:            0

Truncated backtrace:
Thread no. 1 (3 frames)
 #4 btrfs_super_csum_size at ctree.h:1969
 #6 dump_superblock at btrfs-show-super.c:172
 #7 load_and_dump_sb at btrfs-show-super.c:149

Comment 1 Garry T. Williams 2014-01-31 13:02:01 UTC
Created attachment 857830 [details]
File: backtrace

Comment 2 Garry T. Williams 2014-01-31 13:02:05 UTC
Created attachment 857831 [details]
File: cgroup

Comment 3 Garry T. Williams 2014-01-31 13:02:06 UTC
Created attachment 857832 [details]
File: core_backtrace

Comment 4 Garry T. Williams 2014-01-31 13:02:08 UTC
Created attachment 857833 [details]
File: dso_list

Comment 5 Garry T. Williams 2014-01-31 13:02:10 UTC
Created attachment 857834 [details]
File: environ

Comment 6 Garry T. Williams 2014-01-31 13:02:12 UTC
Created attachment 857836 [details]
File: limits

Comment 7 Garry T. Williams 2014-01-31 13:02:14 UTC
Created attachment 857837 [details]
File: maps

Comment 8 Garry T. Williams 2014-01-31 13:02:16 UTC
Created attachment 857838 [details]
File: open_fds

Comment 9 Garry T. Williams 2014-01-31 13:02:26 UTC
Created attachment 857839 [details]
File: proc_pid_status

Comment 10 Garry T. Williams 2014-01-31 13:02:31 UTC
Created attachment 857840 [details]
File: var_log_messages

Comment 11 Eric Sandeen 2014-05-13 16:39:07 UTC
btrfs-progs-3.14.1 has been pushed to Fedora 19 and 20 for testing.

I frankly have no idea if this will resolve your bug or not, but if you test it and find that it does, please take the opportunity to close this bug.  :)

Thanks,
-Eric

Comment 12 Eric Sandeen 2014-05-14 01:39:32 UTC
superblock: bytenr=274877906944, device=/dev/sdc2
---------------------------------------------------------
btrfs-show-super: ctree.h:1984: btrfs_super_csum_size: Assertion `!(t >= (sizeof(btrfs_csum_sizes) / sizeof((btrfs_csum_sizes)[0])))' failed.
csum			0xAborted

Comment 13 Eric Sandeen 2014-05-14 02:03:53 UTC
sent a patch to the list to not print superblocks w/ bad magic, it should avoid most of the non-existent error handling ASSERT problems down this path.

Comment 14 Eric Sandeen 2014-06-17 02:27:10 UTC
This is now in the integration branch at
http://repo.or.cz/w/btrfs-progs-unstable/devel.git/commit/9deac281a66cd3907dc86529a98467c4c46705ac

btrfs-show-super: don't try to print not-superblocks

If we point btrfs-show-super at a not-btrfs-device and
try to print all superblocks, bad things are apt to happen:

superblock: bytenr=274877906944, device=/dev/sdc2
---------------------------------------------------------
btrfs-show-super: ctree.h:1984: btrfs_super_csum_size: \
Assertion `!(t >= (sizeof(btrfs_csum_sizes) / sizeof((btrfs_csum_sizes)[0])))' failed.
csum 0xAborted

Don't try to print superblocks that don't look like superblocks,
and add an "-f" (force) option to try anyway, if the user
really wants to give it a shot.

Fix some spelling & capitalization while we're at it.

The manpage says that if any problem happens, 1 will
be returned, but that's already not true today LOL, so
I didn't bother to make it true when we detect bad
sb magic, either...

I figure it's worth continuing and trying all superblocks
in case just one has a corrupt magic.

Signed-off-by: Eric Sandeen <sandeen>
[renamed -f to -F due to clash with existing option, converted
relevant docs to asciidoc]
Signed-off-by: David Sterba <dsterba>

so I'll close this as UPSTREAM; if you really need it in a Fedora release before the next btrfs-progs rebase let me know, and I can spin up a build.