1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00
lvm2/tools
Ondrej Kozina 0daf9d7ac5 pvmove: fix possible memory pool corruption
This is a hotfix for a bug introduced in
6d7dc87cb3.

The bug description: First we allocate memory for
processing handle (at an address 1) then we
allocate some memory on the same pool for later use
in pvmove_poll function inside the process_each_pv
function (at an address 2). After we jump out of
process_each_pv we called destroy_processing_handle.
As a result of destroying the handle memory pool could
deallocate all memory at address 1 or higher. The
pvmove_poll function tried to copy a memory allocated
at address 2 that could be returned to the system.
If it was so it led to segfault.

We need to rethink proper fix but in the same time
cmd->mem pool is recreated per each lvm command so
this should not cause problems even when we run
multiple commands in lvm shell.

A valgrind snapshot of the corruption:

Invalid read of size 1
    at 0x4C29F92: strlen (mc_replace_strmem.c:403)
    by 0x5495F2E: dm_pool_strdup (pool.c:51)
    by 0x1592A7: _create_id (pvmove.c:774)
    by 0x159409: pvmove_poll (pvmove.c:796)
    by 0x1599E3: pvmove (pvmove.c:931)
    by 0x15105B: lvm_run_command (lvmcmdline.c:1655)
    by 0x1523C3: lvm2_main (lvmcmdline.c:2121)
    by 0x1754F3: main (lvm.c:22)
Address 0xf15df8a is 138 bytes inside a block of size 8,192 free'd
    at 0x4C28430: free (vg_replace_malloc.c:446)
    by 0x5494E73: dm_free_wrapper (dbg_malloc.c:357)
    by 0x5495DE2: _free_chunk (pool-fast.c:318)
    by 0x549561C: dm_pool_free (pool-fast.c:151)
    by 0x164451: destroy_processing_handle (toollib.c:1837)
    by 0x1598C1: pvmove (pvmove.c:903)
    by 0x15105B: lvm_run_command (lvmcmdline.c:1655)
    by 0x1523C3: lvm2_main (lvmcmdline.c:2121)
    by 0x1754F3: main (lvm.c:22)
2016-02-12 11:40:33 +01:00
..
.exported_symbols generate liblvm2cmd exported symbols too 2010-06-25 18:23:10 +00:00
.gitignore gitignore: Update for in-place build. 2015-07-27 13:18:35 +01:00
args.h cleanup: rename usepolicies 2016-02-11 18:35:06 +01:00
cmdnames.h doc: change fsf address 2016-01-21 12:11:37 +01:00
commands.h cleanup: rename usepolicies 2016-02-11 18:35:06 +01:00
dmsetup.c doc: change fsf address 2016-01-21 12:11:37 +01:00
dumpconfig.c doc: change fsf address 2016-01-21 12:11:37 +01:00
errors.h doc: change fsf address 2016-01-21 12:11:37 +01:00
formats.c doc: change fsf address 2016-01-21 12:11:37 +01:00
lvchange.c doc: change fsf address 2016-01-21 12:11:37 +01:00
lvconvert_poll.c doc: change fsf address 2016-01-21 12:11:37 +01:00
lvconvert_poll.h doc: change fsf address 2016-01-21 12:11:37 +01:00
lvconvert.c cleanup: rename usepolicies 2016-02-11 18:35:06 +01:00
lvcreate.c doc: change fsf address 2016-01-21 12:11:37 +01:00
lvdisplay.c doc: change fsf address 2016-01-21 12:11:37 +01:00
lvextend.c doc: change fsf address 2016-01-21 12:11:37 +01:00
lvm2cmd-static.c doc: change fsf address 2016-01-21 12:11:37 +01:00
lvm2cmd.c doc: change fsf address 2016-01-21 12:11:37 +01:00
lvm2cmd.h doc: change fsf address 2016-01-21 12:11:37 +01:00
lvm2cmdline.h doc: change fsf address 2016-01-21 12:11:37 +01:00
lvm-static.c doc: change fsf address 2016-01-21 12:11:37 +01:00
lvm.c doc: change fsf address 2016-01-21 12:11:37 +01:00
lvmchange.c doc: change fsf address 2016-01-21 12:11:37 +01:00
lvmcmdlib.c doc: change fsf address 2016-01-21 12:11:37 +01:00
lvmcmdline.c doc: change fsf address 2016-01-21 12:11:37 +01:00
lvmdiskscan.c doc: change fsf address 2016-01-21 12:11:37 +01:00
lvpoll.c doc: change fsf address 2016-01-21 12:11:37 +01:00
lvreduce.c doc: change fsf address 2016-01-21 12:11:37 +01:00
lvremove.c doc: change fsf address 2016-01-21 12:11:37 +01:00
lvrename.c doc: change fsf address 2016-01-21 12:11:37 +01:00
lvresize.c cleanup: drop unneeded assigns 2016-02-11 18:35:07 +01:00
lvscan.c doc: change fsf address 2016-01-21 12:11:37 +01:00
Makefile.in doc: change fsf address 2016-01-21 12:11:37 +01:00
polldaemon.c doc: change fsf address 2016-01-21 12:11:37 +01:00
pvchange.c doc: change fsf address 2016-01-21 12:11:37 +01:00
pvck.c doc: change fsf address 2016-01-21 12:11:37 +01:00
pvcreate.c doc: change fsf address 2016-01-21 12:11:37 +01:00
pvdisplay.c doc: change fsf address 2016-01-21 12:11:37 +01:00
pvmove_poll.c doc: change fsf address 2016-01-21 12:11:37 +01:00
pvmove_poll.h doc: change fsf address 2016-01-21 12:11:37 +01:00
pvmove.c doc: change fsf address 2016-01-21 12:11:37 +01:00
pvremove.c doc: change fsf address 2016-01-21 12:11:37 +01:00
pvresize.c doc: change fsf address 2016-01-21 12:11:37 +01:00
pvscan.c doc: change fsf address 2016-01-21 12:11:37 +01:00
reporter.c doc: change fsf address 2016-01-21 12:11:37 +01:00
segtypes.c doc: change fsf address 2016-01-21 12:11:37 +01:00
stub.h doc: change fsf address 2016-01-21 12:11:37 +01:00
tags.c doc: change fsf address 2016-01-21 12:11:37 +01:00
tool.h doc: change fsf address 2016-01-21 12:11:37 +01:00
toollib.c pvmove: fix possible memory pool corruption 2016-02-12 11:40:33 +01:00
toollib.h doc: change fsf address 2016-01-21 12:11:37 +01:00
tools.h doc: change fsf address 2016-01-21 12:11:37 +01:00
vgcfgbackup.c doc: change fsf address 2016-01-21 12:11:37 +01:00
vgcfgrestore.c doc: change fsf address 2016-01-21 12:11:37 +01:00
vgchange.c doc: change fsf address 2016-01-21 12:11:37 +01:00
vgck.c doc: change fsf address 2016-01-21 12:11:37 +01:00
vgconvert.c doc: change fsf address 2016-01-21 12:11:37 +01:00
vgcreate.c doc: change fsf address 2016-01-21 12:11:37 +01:00
vgdisplay.c doc: change fsf address 2016-01-21 12:11:37 +01:00
vgexport.c doc: change fsf address 2016-01-21 12:11:37 +01:00
vgextend.c doc: change fsf address 2016-01-21 12:11:37 +01:00
vgimport.c doc: change fsf address 2016-01-21 12:11:37 +01:00
vgmerge.c doc: change fsf address 2016-01-21 12:11:37 +01:00
vgmknodes.c doc: change fsf address 2016-01-21 12:11:37 +01:00
vgreduce.c doc: change fsf address 2016-01-21 12:11:37 +01:00
vgremove.c doc: change fsf address 2016-01-21 12:11:37 +01:00
vgrename.c doc: change fsf address 2016-01-21 12:11:37 +01:00
vgscan.c doc: change fsf address 2016-01-21 12:11:37 +01:00
vgsplit.c doc: change fsf address 2016-01-21 12:11:37 +01:00