Bug 984754 - lvs -a -o +device segfaults
lvs -a -o +device segfaults
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: lvm2 (Show other bugs)
x86_64 Linux
unspecified Severity high
: rc
: ---
Assigned To: Tony Asleson
Cluster QE
Depends On:
  Show dependency treegraph
Reported: 2013-07-15 17:40 EDT by Corey Marthaler
Modified: 2013-07-16 05:14 EDT (History)
9 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2013-07-16 05:14:45 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Corey Marthaler 2013-07-15 17:40:38 EDT
Description of problem:
I accidentally forgot the "s" on the "devices" and found that it caused a segfault.

[root@qalvm-01 ~]# lvs -a -o +device
Segmentation fault (core dumped)

Jul 15 16:33:19 qalvm-01 kernel: [  158.890138] lvs[829]: segfault at 10 ip 00000036cb624667 sp 00007fff007426b0 error 4 in libdevmapper.so.1.02[36cb600000+45000]

(gdb) bt
#0  0x00000036cb624667 in _display_fields (rh=0x14962c0) at libdm-report.c:276
#1  0x00000036cb62532f in _parse_fields (rh=0x14962c0, format=0x14552e8 "lv_name,vg_name,lv_attr,lv_size,pool_lv,origin,data_percent,move_pv,mirror_log,copy_percent,convert_lv,device", 
    report_type_only=1) at libdm-report.c:526
#2  0x00000036cb62585e in dm_report_init (report_types=0x7fff00742840, types=0x72b580 <_report_types>, fields=0x72b660 <_fields>, 
    output_fields=0x14552e8 "lv_name,vg_name,lv_attr,lv_size,pool_lv,origin,data_percent,move_pv,mirror_log,copy_percent,convert_lv,device", output_separator=0x4f7c0b " ", output_flags=7, 
    sort_keys=0x4f7c35 "vg_name,lv_name", private_data=0x1400060) at libdm-report.c:626
#3  0x00000000004bd580 in report_init (cmd=0x1400060, format=0x14552e8 "lv_name,vg_name,lv_attr,lv_size,pool_lv,origin,data_percent,move_pv,mirror_log,copy_percent,convert_lv,device", 
    keys=0x4f7c35 "vg_name,lv_name", report_type=0x7fff00742840, separator=0x4f7c0b " ", aligned=1, buffered=1, headings=1, field_prefixes=0, quoted=1, columns_as_rows=0) at report/report.c:1335
#4  0x00000000004373c5 in _report (cmd=0x1400060, argc=0, argv=0x7fff00742ab8, report_type=LVS) at reporter.c:320
#5  0x0000000000437779 in lvs (cmd=0x1400060, argc=0, argv=0x7fff00742ab8) at reporter.c:406
#6  0x000000000042ccd0 in lvm_run_command (cmd=0x1400060, argc=0, argv=0x7fff00742ab8) at lvmcmdline.c:1145
#7  0x000000000042e1f2 in lvm2_main (argc=4, argv=0x7fff00742a98) at lvmcmdline.c:1581
#8  0x00000000004462f0 in main (argc=4, argv=0x7fff00742a98) at lvm.c:21

Version-Release number of selected component (if applicable):

lvm2-2.02.99-0.79.el7    BUILT: Mon Jul  8 08:28:24 CDT 2013
lvm2-libs-2.02.99-0.79.el7    BUILT: Mon Jul  8 08:28:24 CDT 2013
lvm2-cluster-2.02.99-0.79.el7    BUILT: Mon Jul  8 08:28:24 CDT 2013
device-mapper-1.02.78-0.79.el7    BUILT: Mon Jul  8 08:28:24 CDT 2013
device-mapper-libs-1.02.78-0.79.el7    BUILT: Mon Jul  8 08:28:24 CDT 2013
device-mapper-event-1.02.78-0.79.el7    BUILT: Mon Jul  8 08:28:24 CDT 2013
device-mapper-event-libs-1.02.78-0.79.el7    BUILT: Mon Jul  8 08:28:24 CDT 2013
cmirror-2.02.99-0.79.el7    BUILT: Mon Jul  8 08:28:24 CDT 2013

How reproducible:
Comment 2 Peter Rajnoha 2013-07-16 05:14:45 EDT
This was caused by new report type LVCREATE_PARAMS introduced with https://git.fedorahosted.org/cgit/lvm2.git/commit/?id=4d5de8322b3a6050def60542b167b46d97b2824d

However, this one has been reverted later on with https://git.fedorahosted.org/cgit/lvm2.git/commit/?id=dd302daf646f680531bf76ab13a9dafd06f63220.

Tony, there was missing proper registration of the new report type here in this struct:

static const struct dm_report_object_type _report_types[] = {
        { VGS, "Volume Group", "vg_", _obj_get_vg },
        { LVS, "Logical Volume", "lv_", _obj_get_lv },
        { PVS, "Physical Volume", "pv_", _obj_get_pv },
        { LABEL, "Physical Volume Label", "pv_", _obj_get_pv },
        { SEGS, "Logical Volume Segment", "seg_", _obj_get_seg },
        { PVSEGS, "Physical Volume Segment", "pvseg_", _obj_get_pvseg },
        { 0, "", "", NULL },

There should have been a new line, e.g.:

        { LV_CREATE_PARAMS, "LV Creation Params", "lvcreate_params_", _obj_get_lvcreate_params },

Anyway, I'm closing this report now as the patch is not used with current upstream at the moment. But if you're going to resubmit the patch, this needs to be fixed then...

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