]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit
repair: superblock buffers need to be sector sized
authorDave Chinner <dchinner@redhat.com>
Wed, 18 Mar 2015 04:10:09 +0000 (15:10 +1100)
committerDave Chinner <david@fromorbit.com>
Wed, 18 Mar 2015 04:10:09 +0000 (15:10 +1100)
commit8bc43a39facea94cc276df86956f4e6bf1ad05f6
treead8c8af8d93b4388e471bb8c027813f907c7335a
parentbd76b93e4315982575f78f3e68238396ff636dee
repair: superblock buffers need to be sector sized

In secondary_sb_wack() we zero the unused portion of both the
on-disk superblock and the in-memory copy that we have. When
the device sector size is 4k, this causes xfs_repair to crash like
so:

# xfs_repair /dev/ram1
Phase 1 - find and verify superblock...
Phase 2 - using internal log
        - zero log...
        - scan filesystem freespace and inode maps...
bad magic number
bad on-disk superblock 3 - bad magic number
primary/secondary superblock 3 conflict - AG superblock geometry info conflicts with filesystem geometry
zeroing unused portion of secondary superblock (AG #3)
#

The stack trace is indicative:

#0  memset ()
#1  0x000000000040404b in secondary_sb_wack
#2  verify_set_agheader
#3  0x0000000000427b4b in scan_ag
#4  0x000000000042a2ca in worker_thread
#5  0x00007ffff77ba0a4 in start_thread
#6  0x00007ffff74efc2d in clone

Which points at memset overrunning the in memory buffer, as it is
only 512 bytes in length.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
repair/scan.c