Bug 504312

Summary: Several lvm2 commands can segfault during repairing inconsistent metadata
Product: Red Hat Enterprise Linux 5 Reporter: Milan Broz <mbroz>
Component: lvm2Assignee: Milan Broz <mbroz>
Status: CLOSED ERRATA QA Contact: Cluster QE <mspqa-list>
Severity: high Docs Contact:
Priority: high    
Version: 5.4CC: agk, cmarthal, coughlan, dwysocha, edamato, heinzm, jbrassow, mbroz, prockai, pvrabec, syeghiay
Target Milestone: rcKeywords: Regression
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-09-02 11:56:49 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Milan Broz 2009-06-05 14:36:09 UTC
Description of problem:

Some lvm2 commands tries to repair inconsistent metadata (vgchange, vgconvert, vgscan).

Current code incorectly releases old volume group metadata twice from memory, causeing commands segfault of glibc warnings:


# vgscan
  Reading all physical volumes.  This may take a while...
  Volume group "vg_test" inconsistent
  WARNING: Inconsistent metadata found for VG vg_test - updating to use version 3
  Removing PV /dev/mapper/x (1nxHIW-2Thk-9mS4-2TzO-zHlB-Hsy2-CZsjE7) that no longer belongs to VG vg_test
  Found volume group "vg_test" using metadata type lvm2
Segmentation fault

OR

# vgscan
  Reading all physical volumes.  This may take a while...
  Found volume group "vg_rhel4" using metadata type lvm2 
  Found volume group "myvg" using metadata type lvm2     
  Volume group "vg_test" inconsistent                    
  WARNING: Inconsistent metadata found for VG vg_test - updating to use version 4
  Removing PV /dev/mapper/x (T5Fj1R-fvs6-9UZG-oaix-Fmtz-WybW-bhyJ37) that no longer belongs to VG vg_test                                                                         
  Found volume group "vg_test" using metadata type lvm2                                  
*** glibc detected *** vgscan: double free or corruption (out): 0x006d54c0 ***           
======= Backtrace: =========                                                             
/lib/libc.so.6[0x5fd0f1]                                                                 
/lib/libc.so.6(cfree+0x90)[0x600bc0]                                                     
/lib/libdevmapper.so.1.02(dm_pool_destroy+0x22)[0x4a6da2]                                
vgscan(vg_release+0x34)[0x80a1624]                                                       
vgscan[0x806bc1b]                                                                        
vgscan(process_each_vg+0x12c)[0x806c83c]                                                 
vgscan(vgscan+0x12c)[0x807389c]                                                          
vgscan(lvm_run_command+0xf18)[0x805f3d8]                                                 
vgscan(lvm2_main+0x4ca)[0x805fa2a]                                                       
vgscan(main+0x32)[0x8075422]                                                             
/lib/libc.so.6(__libc_start_main+0xdc [0x5a9e8c]                                         
vgscan[0x80528c1]                                                                        
...

Version-Release number of selected component (if applicable):
# rpm -q lvm2
lvm2-2.02.46-3.el5

This is regression, patch (in review) is available.

Comment 4 Milan Broz 2009-06-06 21:25:47 UTC
Fixed in lvm2-2.02.46-5.el5.

Comment 7 Corey Marthaler 2009-07-07 20:50:45 UTC
Ran the script provided in comment #1 and didn't see a segfault, marking verified in lvm2-2.02.46-8.el5.

Comment 9 errata-xmlrpc 2009-09-02 11:56:49 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2009-1393.html