1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-22 17:35:59 +03:00
lvm2/lib/format1
Zdenek Kabelac 142d2e8740 Fix reading of unitialized memory
Could be reached via few of our lvm2 test cases:

==11501== Invalid read of size 8
==11501==    at 0x49B2E0: _area_length (import-extents.c:204)
==11501==    by 0x49B40C: _read_linear (import-extents.c:222)
==11501==    by 0x49B952: _build_segments (import-extents.c:323)
==11501==    by 0x49B9A0: _build_all_segments (import-extents.c:334)
==11501==    by 0x49BB4C: import_extents (import-extents.c:364)
==11501==    by 0x497655: _format1_vg_read (format1.c:217)
==11501==    by 0x47E43E: _vg_read (metadata.c:2901)

cut from t-vgcvgbackup-usage.sh
--
pvcreate -M1 $(cat DEVICES)
vgcreate -M1 -c n $vg $(cat DEVICES)
lvcreate -l1 -n $lv1 $vg $dev1
--

Idea of the fix is rather defensive - to allocate one extra element
to 'map' array which is then used in _area_length() - where the
loop checks, whether next map entry is continuous.

By placing there always one extra zero entry -
we fix the read of unallocated memory, and we make sure the data would
not make a continous block.

FIXME: there could be a problem if some special broken lvm1 data would be imported.
As the format1 is currently not really used - leave it for future fix
and use this small hotfix for now.
2011-03-30 12:30:39 +00:00
..
.exported_symbols .export.sym generation 2004-03-26 14:51:23 +00:00
disk-rep.c Fallback to full rescan for missing device 2010-12-01 10:33:55 +00:00
disk-rep.h Use __attribute__ consistently throughout. 2010-07-09 15:34:40 +00:00
format1.c Use format instance mempool where possible and adequate. 2011-03-11 15:10:16 +00:00
format1.h split orphan VG by format type 2008-02-06 15:47:28 +00:00
import-export.c Fix allocation of system_id 2011-03-13 23:05:48 +00:00
import-extents.c Fix reading of unitialized memory 2011-03-30 12:30:39 +00:00
layout.c Some whitespace tidy-ups. 2008-01-30 14:00:02 +00:00
lvm1-label.c Use __attribute__ consistently throughout. 2010-07-09 15:34:40 +00:00
lvm1-label.h Fix inconsistent licence notices: executables are GPLv2; libraries LGPLv2.1. 2007-08-20 20:55:30 +00:00
Makefile.in Install plugins to subdirs 2010-05-06 10:07:46 +00:00
vg_number.c Right, a simple build (without options) is working again. 2008-11-03 22:14:30 +00:00