Red Hat Bugzilla – Bug 1476769
segmentation fault when running thin_rmap from bad file
Last modified: 2018-04-10 09:18:07 EDT
Description of problem: Running thin_rmap from file that won't pass thin_check (block out of bounds) leads to segmentation fault. This file can even be random existing one. [root@storageqe-21 thin]# thin_check /tmp/metadata_repair examining superblock examining devices tree examining mapping tree checking space map counts [root@storageqe-21 thin]# thin_rmap --region 0..-1 /tmp/metadata_repair data 0..3 -> thin(1) 0..3 data 3..19 -> thin(1) 8..24 data 19..20 -> thin(1) 128..129 data 20..21 -> thin(1) 191..192 data 21..24 -> thin(2) 0..3 data 24..40 -> thin(2) 8..24 data 40..41 -> thin(2) 128..129 data 41..42 -> thin(2) 191..192 data 42..45 -> thin(3) 0..3 data 45..61 -> thin(3) 8..24 data 61..62 -> thin(3) 128..129 data 62..63 -> thin(3) 191..192 data 63..66 -> thin(4) 0..3 data 66..82 -> thin(4) 8..24 data 82..83 -> thin(4) 128..129 data 83..84 -> thin(4) 191..192 data 84..87 -> thin(5) 0..3 data 87..103 -> thin(5) 8..24 data 103..104 -> thin(5) 128..129 data 104..105 -> thin(5) 191..192 data 105..108 -> thin(6) 0..3 data 108..124 -> thin(6) 8..24 data 124..125 -> thin(6) 128..129 data 125..126 -> thin(6) 191..192 data 126..129 -> thin(7) 0..3 data 129..145 -> thin(7) 8..24 data 145..146 -> thin(7) 128..129 data 146..147 -> thin(7) 191..192 data 147..150 -> thin(8) 0..3 data 150..166 -> thin(8) 8..24 data 166..167 -> thin(8) 128..129 data 167..168 -> thin(8) 191..192 data 168..171 -> thin(9) 0..3 data 171..187 -> thin(9) 8..24 data 187..188 -> thin(9) 128..129 data 188..189 -> thin(9) 191..192 data 189..192 -> thin(10) 0..3 data 192..208 -> thin(10) 8..24 data 208..209 -> thin(10) 128..129 data 209..210 -> thin(10) 191..192 [root@storageqe-21 thin]# thin_rmap --region 0..-1 /tmp/metadata Segmentation fault (core dumped) [root@storageqe-21 thin]# thin_check /tmp/metadata examining superblock superblock is corrupt block out of bounds (0 >= 0) Version-Release number of selected component (if applicable): device-mapper-persistent-data-0.7.0-0.1.rc6.el7 How reproducible: 100% Steps to Reproduce: 1.thin_rmap $RANDOM_EXISTING_FILE Actual results: Segmentation fault (core dumped) Expected results: warning saying wrong metadata Additional info:
Reproducer: https://github.com/jthornber/thin-provisioning-tools/commit/4e1b7f89ee8f876b2d04d8079fcbc2fbfacbc73d Fix: https://github.com/jthornber/thin-provisioning-tools/commit/3c761e68221b4d06ae4cb2805dcc9ce1e2c90a5d
The segmentation fault itself is fixed in device-mapper-persistent-data-0.7.3-1.el7, but it is missing newline at the end of "Metadata is not large enough for superblock.". # thin_check PURPOSE Metadata device/file too small. Is this binary metadata? # thin_rmap --region 0..-1 PURPOSE Metadata is not large enough for superblock.# thin_rmap --region 0..-1 PURPOSE Metadata is not large enough for superblock.# Joe, should I create a new BZ for the missing newline char or can you fix it in this one? Thanks
Setting to verified as that is too minor issue to prevent it.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHEA-2018:0776