Bug 1473747 - Segmentation fault when running thin_repair or thin_ls on thin_dump metadata
Segmentation fault when running thin_repair or thin_ls on thin_dump metadata
Status: VERIFIED
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: device-mapper-persistent-data (Show other bugs)
7.4
Unspecified Unspecified
unspecified Severity medium
: rc
: ---
Assigned To: Joe Thornber
Jakub Krysl
:
Depends On:
Blocks: 1469559
  Show dependency treegraph
 
Reported: 2017-07-21 10:30 EDT by Jakub Krysl
Modified: 2017-10-09 04:57 EDT (History)
7 users (show)

See Also:
Fixed In Version: device-mapper-persistent-data-0.7.3-1.el7
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Jakub Krysl 2017-07-21 10:30:40 EDT
Description of problem:
Running thin_repair from metadata obtained from thin_dump leads to segmentation fault. This happens on both file and device output.

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_dump $metadata_device >> $metadata_file
2. thin_repair -i $metadata_file -o $whatever

Actual results:
Segmentation fault (core dumped)

Expected results:
metadata repaired or warning (metadata check)

Additional info:

reason:
pdata_tools killed by SIGSEGV

core_backtrace:
{   "signal": 11
,   "executable": "/usr/sbin/pdata_tools"
,   "stacktrace":
      [ {   "crash_thread": true
        ,   "frames":
              [ {   "address": 4301400
                ,   "build_id": "f2c65c6ba05eda53b370e8f896fec88373fbc877"
                ,   "build_id_offset": 107096
                ,   "function_name": "persistent_data::core_map::inc(unsigned long)"
                ,   "file_name": "/usr/sbin/pdata_tools"
                }
              , {   "address": 4857464
                ,   "build_id": "f2c65c6ba05eda53b370e8f896fec88373fbc877"
                ,   "build_id_offset": 663160
                ,   "function_name": "(anonymous namespace)::open_tm(boost::shared_ptr<persistent_data::block_manager<4096u> >)"
                ,   "file_name": "/usr/sbin/pdata_tools"
                }
              , {   "address": 4861181
                ,   "build_id": "f2c65c6ba05eda53b370e8f896fec88373fbc877"
                ,   "build_id_offset": 666877
                ,   "function_name": "thin_provisioning::metadata::metadata(boost::shared_ptr<persistent_data::block_manager<4096u> >, bool)"
                ,   "file_name": "/usr/sbin/pdata_tools"
                }
              , {   "address": 5042759
                ,   "build_id": "f2c65c6ba05eda53b370e8f896fec88373fbc877"
                ,   "build_id_offset": 848455
                ,   "function_name": "thin_provisioning::thin_repair_cmd::run(int, char**)"
                ,   "file_name": "/usr/sbin/pdata_tools"
                }
              , {   "address": 4236175
                ,   "build_id": "f2c65c6ba05eda53b370e8f896fec88373fbc877"
                ,   "build_id_offset": 41871
                ,   "function_name": "base::application::run(int, char**)"
                ,   "file_name": "/usr/sbin/pdata_tools"
                }
              , {   "address": 4232798
                ,   "build_id": "f2c65c6ba05eda53b370e8f896fec88373fbc877"
                ,   "build_id_offset": 38494
                ,   "function_name": "main"
                ,   "file_name": "/usr/sbin/pdata_tools"
                } ]
        } ]
}
Comment 2 Jakub Krysl 2017-07-31 10:33:06 EDT
thin_ls does the same:

[root@storageqe-21 thin]# thin_check /dev/mapper/vgtest-swapvol 
examining superblock
examining devices tree
examining mapping tree
checking space map counts
[root@storageqe-21 thin]# thin_check /tmp/metadata
Couldn't stat path
[root@storageqe-21 thin]# thin_dump /dev/mapper/vgtest-swapvol >> /tmp/metadata
[root@storageqe-21 thin]# thin_check /tmp/metadata
examining superblock
  superblock is corrupt
    block out of bounds (0 >= 0)

[root@storageqe-21 thin]# thin_ls /tmp/metadata
Segmentation fault (core dumped)
Comment 3 Joe Thornber 2017-09-29 06:05:56 EDT
As mentioned in another bz, you are trying to run thin_check and thin_ls on the XML exported from thin_dump, rather on the binary metadata that the kernel uses.

The segmentation fault should not occur, and has been fixed recently.  I've added the following test to make sure:

https://github.com/jthornber/thin-provisioning-tools/commit/331303fe03d99002934ae575fa6026490078d2e6
Comment 5 Jakub Krysl 2017-10-09 04:57:57 EDT
Fixed in device-mapper-persistent-data-0.7.3-1.el7.

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