Bug 1021247 - "pvs -a" segfaults in lvmcache
"pvs -a" segfaults in lvmcache
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: lvm2 (Show other bugs)
19
Unspecified Unspecified
medium Severity high
: ---
: ---
Assigned To: Peter Rajnoha
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-10-20 14:07 EDT by Heinz Mauelshagen
Modified: 2014-02-19 19:46 EST (History)
12 users (show)

See Also:
Fixed In Version: lvm2-2.02.98-15.fc19
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-02-19 19:46:22 EST
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 Heinz Mauelshagen 2013-10-20 14:07:15 EDT
Description of problem:

"pvs -a" segfaults in lvmcache.c:1840


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

  LVM version:     2.02.98(2) (2012-10-15)
  Library version: 1.02.77 (2012-10-15)

How reproducible:

Always in qemu with

 253        0   41943040 vda
 253        1     524288 vda1
 253        2    3145728 vda2
 253        3   38272000 vda3
 253       16   33554432 vdb
 253       32 8187282432 vdc
 253       48 8187282432 vdd
 253       64 8589935616 vde
 252        0     524288 dm-0
 252        1   17825792 dm-1
 252        2     524288 dm-2
 252        3 1073741824 dm-3
 252        4 1073741824 dm-4



Steps to Reproduce:
1. Prepare Fedora 19 VM with aforementioned block devices
2. Run "pvs -a"
3.

Actual results:

Segfault

Expected results:

Output of all block devices.

Additional info:
Comment 1 Zdenek Kabelac 2014-01-28 09:15:12 EST
Is this bug still unfixed with the latest build for f19:  lvm2-2.02.98-14.fc19 ?
Comment 2 Xavier Bachelot 2014-02-16 15:11:56 EST
I see a segfault at the same place when doing a pvcreate on a soft raid-1 on a 3 Tb disk. lvm2 is at version 2.02.98-14.fc19 on a 32 bits system. A simple 'pvs -a' like the original reporter segfaults too. 

Here's the trace :
# gdb pvcreate
GNU gdb (GDB) Fedora 7.6.1-46.fc19
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/sbin/lvm...Reading symbols from /usr/lib/debug/usr/sbin/lvm.debug...done.
done.
(gdb) run /dev/md2
Starting program: /sbin/pvcreate /dev/md2
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/libthread_db.so.1".
File descriptor 3 (socket:[33562]) leaked on pvcreate invocation. Parent PID 2870: gdb
File descriptor 4 (socket:[33563]) leaked on pvcreate invocation. Parent PID 2870: gdb
File descriptor 5 (pipe:[33571]) leaked on pvcreate invocation. Parent PID 2870: gdb
File descriptor 6 (pipe:[33571]) leaked on pvcreate invocation. Parent PID 2870: gdb

Program received signal SIGSEGV, Segmentation fault.
0x800486e4 in lvmcache_get_label (info=info@entry=0x0) at cache/lvmcache.c:1840
1840            return info->label;
Missing separate debuginfos, use: debuginfo-install libgcc-4.8.2-7.fc19.i686 libselinux-2.1.13-15.fc19.i686 libsepol-2.1.9-1.fc19.i686 ncurses-libs-5.9-11.20130511.fc19.i686 pcre-8.32-8.fc19.i686
(gdb) bt full
#0  0x800486e4 in lvmcache_get_label (info=info@entry=0x0) at cache/lvmcache.c:1840
No locals.
#1  0x80082a9e in _pv_read (cmd=<optimized out>, pvmem=0x8013ebe8, pv_name=0xbffff859 "/dev/md2", fid=0x0, warnings=0, scan_label_only=0) at metadata/metadata.c:3641
        pv = <optimized out>
        label = 0xffffffff
        info = 0x0
        dev = 0x8013f190
        fmt = <optimized out>
        found = 1
#2  0x80082ece in pv_read (cmd=<optimized out>, cmd@entry=0x80129878, pv_name=<optimized out>, pv_name@entry=0xbffff859 "/dev/md2", warnings=warnings@entry=0, scan_label_only=scan_label_only@entry=0) at metadata/metadata.c:3608
No locals.
#3  0x80086480 in pvcreate_check (pp=0xbffff3e8, name=0xbffff859 "/dev/md2", cmd=0x80129878) at metadata/metadata.c:1330
        pv = <optimized out>
        dev = <optimized out>
#4  pvcreate_single (cmd=cmd@entry=0x80129878, pv_name=0xbffff859 "/dev/md2", pp=pp@entry=0xbffff3e8, write_now=write_now@entry=1) at metadata/metadata.c:1522
        pv = 0x0
        dev = <optimized out>
        mdas = {n = 0x0, p = 0x0}
        default_pp = {<No data fields>}
        buffer = '\000' <repeats 63 times>
#5  0x8002b041 in pvcreate (cmd=0x80129878, argc=1, argv=0xbffff718) at pvcreate.c:116
        i = 0
        ret = 1
        pp = {zero = 1, size = 0, data_alignment = 0, data_alignment_offset = 0, pvmetadatacopies = 1, pvmetadatasize = 255, labelsector = 1, id = {uuid = '\000' <repeats 31 times>}, idp = 0x0, pe_start = 0, extent_count = 0, 
          extent_size = 0, restorefile = 0x0, force = PROMPT, yes = 0, metadataignore = 0}
        pv = <optimized out>
#6  0x80024513 in lvm_run_command (cmd=cmd@entry=0x80129878, argc=1, argc@entry=2, argv=0xbffff718, argv@entry=0xbffff714) at lvmcmdline.c:1120
        ret = <optimized out>
        locking_type = -1
        monitoring = 1
        old_cft = <optimized out>
#7  0x80024b2e in lvm2_main (argc=argc@entry=2, argv=argv@entry=0xbffff714) at lvmcmdline.c:1554
        base = <optimized out>
        ret = <optimized out>
        alias = 1
        cmd = 0x80129878
#8  0x800119b8 in main (argc=2, argv=0xbffff714) at lvm.c:21
No locals.
Comment 3 Peter Rajnoha 2014-02-17 04:13:47 EST
Based on the backtrace, this patch should be added:

https://git.fedorahosted.org/cgit/lvm2.git/commit/?id=401c9aba4a1d37d2bb05467e8860876929db9a8c

It's prepared for next F19 lvm2 rebuild.
Comment 4 Xavier Bachelot 2014-02-17 04:27:51 EST
Thanks for the very quick answer Peter.
I see the fix is already in a more recent lvm2 release than what's in F19. Would current F20 lvm2 package (2.02.103-5) be safe to rebuild and install on my F19 machine or shall I wait for an official F19 build ? Also, I can indeed test a koji build as soon as there is one ready, let me know.
Comment 5 Peter Rajnoha 2014-02-17 05:15:05 EST
(In reply to Xavier Bachelot from comment #4)
> Would current F20 lvm2 package (2.02.103-5) be safe to rebuild and install

I wouldn't recommend that in case you're using LVM on MD (you mentioned you're using LVM on sw raid1) - we've improved LVM on MD handling in other packages as well (dracut initramfs, mdadm) to fix stack handling where LVM is used on top of MD RAID - so there also some other changes/fixes in other packages and they need to be in sync with lvm2. So if possible, I'd really recommend upgrading to F20 instead in this case...

Anyway, you can try this F19 scratch build that has the patch mentioned in comment #3 and let's see if it helps.
Comment 6 Peter Rajnoha 2014-02-17 05:15:30 EST
The scratch build:
  http://koji.fedoraproject.org/koji/taskinfo?taskID=6537270
Comment 7 Xavier Bachelot 2014-02-17 06:12:50 EST
The scratch build worked for me, no segfault anymore. I tested both 'pvs -a' and 'pvcreate'.
Thanks again Peter :-)
Comment 8 Fedora Update System 2014-02-17 09:53:30 EST
lvm2-2.02.98-15.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/lvm2-2.02.98-15.fc19
Comment 9 Fedora Update System 2014-02-18 08:45:15 EST
Package lvm2-2.02.98-15.fc19:
* should fix your issue,
* was pushed to the Fedora 19 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing lvm2-2.02.98-15.fc19'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-2701/lvm2-2.02.98-15.fc19
then log in and leave karma (feedback).
Comment 10 Fedora Update System 2014-02-19 19:46:22 EST
lvm2-2.02.98-15.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.

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