1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-10-28 11:55:55 +03:00
lvm2/lib/metadata
Zdenek Kabelac b680d5bf7b Fix use of released vgname and vgid
Avoid using of already released memory when duplicated MDA is found.

As get_pv_from_vg_by_id() may call lvmcache_label_scan() use the local copy
of the vgname and vgid on the stack as vginfo may dissapear and code was
then accessing garbage in memory.

i.e.  pvs  /dev/loop0
(when /dev/loop0 and /dev/loop1 has same MDA content)

Invalid read of size 1
   at 0x523C986: dm_hash_lookup (hash.c:325)
   by 0x440C8C: vginfo_from_vgname (lvmcache.c:399)
   by 0x4605C0: _create_vg_text_instance (format-text.c:1882)
   by 0x46140D: _text_create_text_instance (format-text.c:2243)
   by 0x47EB49: _vg_read (metadata.c:2887)
   by 0x47FBD8: vg_read_internal (metadata.c:3231)
   by 0x477594: get_pv_from_vg_by_id (metadata.c:344)
   by 0x45F07A: _get_pv_if_in_vg (format-text.c:1400)
   by 0x45F0B9: _populate_pv_fields (format-text.c:1414)
   by 0x45F40F: _text_pv_read (format-text.c:1493)
   by 0x480431: _pv_read (metadata.c:3500)
   by 0x4802B2: pv_read (metadata.c:3462)
 Address 0x652ab80 is 0 bytes inside a block of size 4 free'd
   at 0x4C2756E: free (vg_replace_malloc.c:366)
   by 0x442277: _free_vginfo (lvmcache.c:963)
   by 0x44235E: _drop_vginfo (lvmcache.c:992)
   by 0x442B23: _lvmcache_update_vgname (lvmcache.c:1165)
   by 0x443449: lvmcache_update_vgname_and_id (lvmcache.c:1358)
   by 0x443C07: lvmcache_add (lvmcache.c:1492)
   by 0x46588C: _text_read (text_label.c:271)
   by 0x466A65: label_read (label.c:289)
   by 0x4413FC: lvmcache_label_scan (lvmcache.c:635)
   by 0x4605AD: _create_vg_text_instance (format-text.c:1881)
   by 0x46140D: _text_create_text_instance (format-text.c:2243)
   by 0x47EB49: _vg_read (metadata.c:2887)

Add testing script
2011-04-21 13:13:40 +00:00
..
lv_alloc.h Fix pvmove allocation to take existing parallel stripes into account. 2010-04-08 00:28:57 +00:00
lv_manip.c Fix incorrect tests for dm_snprintf() failure 2011-04-09 19:05:23 +00:00
lv.c This patchset refactors some reporting code and completes the remaining 2011-04-12 12:24:29 +00:00
lv.h This patchset refactors some reporting code and completes the remaining 2011-04-12 12:24:29 +00:00
merge.c Replicator: check replicator segment 2010-05-21 12:43:02 +00:00
metadata-exported.h This patch adds the ability to extend 0 length layered LVs. This 2011-04-06 21:32:20 +00:00
metadata.c Fix use of released vgname and vgid 2011-04-21 13:13:40 +00:00
metadata.h Use only vg_set_fid and new pv_set_fid fn to assign the format instance. 2011-03-11 14:50:13 +00:00
mirror.c Replace dm_snprintf with strncpy 2011-04-12 14:13:17 +00:00
pv_alloc.h Fix all segments memory is allocated from vg private mempool. 2010-03-31 17:23:18 +00:00
pv_manip.c Improve the discard documentation. Also improve discard code in 2011-04-13 18:26:39 +00:00
pv_map.c Allow ALLOC_ANYWHERE to split contiguous areas. 2010-03-25 21:19:26 +00:00
pv_map.h Remove superfluous fn prototypes. 2010-07-09 15:21:10 +00:00
pv.c Fix metadata balance code to work with recent changes in metadata handling 2011-02-21 12:33:16 +00:00
pv.h Add old_uuid field to struct physical_volume so we can still reference a PV 2011-02-21 12:31:28 +00:00
replicator_manip.c Rename vg_release to free_vg. 2010-12-08 20:50:48 +00:00
segtype.c Handle metadata with unknown segment types more gracefully. 2009-10-16 17:41:49 +00:00
segtype.h Remove const usage from destroy callbacks 2010-12-20 13:32:49 +00:00
snapshot_manip.c When removing a snapshot avoid preloading the origin if the 2010-04-23 02:57:39 +00:00
vg.c Refactor vg allocation code 2011-03-10 12:43:29 +00:00
vg.h Refactor vg allocation code 2011-03-10 12:43:29 +00:00