mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-22 07:03:38 +00:00
run: Set MALLOC_PERTURB_ to a random value.
MALLOC_PERTURB_ is a glibc feature which causes malloc to wipe memory before and after it is used, allowing both use-after-free and uninitialized reads to be detected with relatively little performance penalty: http://udrepper.livejournal.com/11429.html?nojs=1 Modify the ./run script so that it always sets this. We were already using MALLOC_PERTURB_ in most tests. Since ./run is now setting this, we can remove it from individual Makefiles. Most TESTS_ENVIRONMENT will now simply look like this: TESTS_ENVIRONMENT = $(top_builddir)/run --test
This commit is contained in:
@@ -70,10 +70,6 @@ stamp-virt-alignment-scan.pod: virt-alignment-scan.pod
|
||||
|
||||
# Tests.
|
||||
|
||||
# random_val := $(shell awk 'BEGIN{srand(); print 1+int(255*rand())}' < /dev/null)
|
||||
|
||||
# TESTS_ENVIRONMENT = \
|
||||
# MALLOC_PERTURB_=$(random_val) \
|
||||
# $(top_builddir)/run --test
|
||||
# TESTS_ENVIRONMENT = $(top_builddir)/run --test
|
||||
|
||||
# TESTS = test-virt-alignment-scan.sh
|
||||
|
||||
@@ -128,11 +128,7 @@ stamp-virt-filesystems.pod: virt-filesystems.pod
|
||||
|
||||
# Tests.
|
||||
|
||||
random_val := $(shell awk 'BEGIN{srand(); print 1+int(255*rand())}' < /dev/null)
|
||||
|
||||
TESTS_ENVIRONMENT = \
|
||||
MALLOC_PERTURB_=$(random_val) \
|
||||
$(top_builddir)/run --test
|
||||
TESTS_ENVIRONMENT = $(top_builddir)/run --test
|
||||
|
||||
if ENABLE_APPLIANCE
|
||||
TESTS = test-virt-cat.sh test-virt-filesystems.sh test-virt-ls.sh
|
||||
|
||||
@@ -74,11 +74,7 @@ stamp-virt-df.pod: virt-df.pod
|
||||
|
||||
# Tests.
|
||||
|
||||
random_val := $(shell awk 'BEGIN{srand(); print 1+int(255*rand())}' < /dev/null)
|
||||
|
||||
TESTS_ENVIRONMENT = \
|
||||
MALLOC_PERTURB_=$(random_val) \
|
||||
$(top_builddir)/run --test
|
||||
TESTS_ENVIRONMENT = $(top_builddir)/run --test
|
||||
|
||||
if ENABLE_APPLIANCE
|
||||
TESTS = test-virt-df.sh
|
||||
|
||||
@@ -66,11 +66,7 @@ stamp-virt-edit.pod: virt-edit.pod
|
||||
|
||||
# Tests.
|
||||
|
||||
random_val := $(shell awk 'BEGIN{srand(); print 1+int(255*rand())}' < /dev/null)
|
||||
|
||||
TESTS_ENVIRONMENT = \
|
||||
MALLOC_PERTURB_=$(random_val) \
|
||||
$(top_builddir)/run --test
|
||||
TESTS_ENVIRONMENT = $(top_builddir)/run --test
|
||||
|
||||
if ENABLE_APPLIANCE
|
||||
TESTS = test-virt-edit.sh
|
||||
|
||||
@@ -229,11 +229,7 @@ bashcompletion_DATA = guestfish-bash-completion.sh
|
||||
|
||||
# Tests.
|
||||
|
||||
random_val := $(shell awk 'BEGIN{srand(); print 1+int(255*rand())}' < /dev/null)
|
||||
|
||||
TESTS_ENVIRONMENT = \
|
||||
MALLOC_PERTURB_=$(random_val) \
|
||||
$(top_builddir)/run --test
|
||||
TESTS_ENVIRONMENT = $(top_builddir)/run --test
|
||||
|
||||
TESTS = \
|
||||
test-a.sh \
|
||||
|
||||
@@ -67,11 +67,7 @@ stamp-virt-format.pod: virt-format.pod
|
||||
|
||||
# Tests.
|
||||
|
||||
random_val := $(shell awk 'BEGIN{srand(); print 1+int(255*rand())}' < /dev/null)
|
||||
|
||||
TESTS_ENVIRONMENT = \
|
||||
MALLOC_PERTURB_=$(random_val) \
|
||||
$(top_builddir)/run --test
|
||||
TESTS_ENVIRONMENT = $(top_builddir)/run --test
|
||||
|
||||
if ENABLE_APPLIANCE
|
||||
TESTS = test-virt-format.sh
|
||||
|
||||
@@ -108,11 +108,7 @@ utils_tests: resize_gettext.cmx utils.cmx utils_tests.cmx
|
||||
$(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) \
|
||||
mlguestfs.cmxa -linkpkg $^ -cclib -lncurses -o $@
|
||||
|
||||
random_val := $(shell awk 'BEGIN{srand(); print 1+int(255*rand())}' < /dev/null)
|
||||
|
||||
TESTS_ENVIRONMENT = \
|
||||
MALLOC_PERTURB_=$(random_val) \
|
||||
$(top_builddir)/run --test
|
||||
TESTS_ENVIRONMENT = $(top_builddir)/run --test
|
||||
|
||||
TESTS = utils_tests
|
||||
if ENABLE_APPLIANCE
|
||||
|
||||
5
run.in
5
run.in
@@ -76,6 +76,11 @@ export GI_TYPELIB_PATH
|
||||
|
||||
export LIBGUESTFS_PATH="$b/appliance"
|
||||
|
||||
# This is a cheap way to find some use-after-free and uninitialized
|
||||
# read problems when using glibc.
|
||||
random_val="$(awk 'BEGIN{srand(); print 1+int(255*rand())}' < /dev/null)"
|
||||
export MALLOC_PERTURB_=$random_val
|
||||
|
||||
# Do we have libtool? If we have it then we can use it to make
|
||||
# running valgrind simpler. However don't depend on it.
|
||||
if libtool --help >/dev/null 2>&1; then
|
||||
|
||||
@@ -101,11 +101,7 @@ CLEANFILES += stamp-virt-sparsify.pod
|
||||
|
||||
# Tests.
|
||||
|
||||
random_val := $(shell awk 'BEGIN{srand(); print 1+int(255*rand())}' < /dev/null)
|
||||
|
||||
TESTS_ENVIRONMENT = \
|
||||
MALLOC_PERTURB_=$(random_val) \
|
||||
$(top_builddir)/run --test
|
||||
TESTS_ENVIRONMENT = $(top_builddir)/run --test
|
||||
|
||||
if ENABLE_APPLIANCE
|
||||
TESTS = test-virt-sparsify.sh
|
||||
|
||||
@@ -162,10 +162,7 @@ sysprep-operations.pod: virt-sysprep
|
||||
|
||||
# Tests.
|
||||
|
||||
random_val := $(shell awk 'BEGIN{srand(); print 1+int(255*rand())}' < /dev/null)
|
||||
|
||||
TESTS_ENVIRONMENT = \
|
||||
MALLOC_PERTURB_=$(random_val) \
|
||||
abs_builddir=$(abs_builddir) \
|
||||
abs_srcdir=$(abs_srcdir) \
|
||||
$(top_builddir)/run --test
|
||||
|
||||
@@ -21,11 +21,7 @@ TESTS = \
|
||||
test-btrfs-devices.sh \
|
||||
test-btrfs-subvolume-default.pl
|
||||
|
||||
random_val := $(shell awk 'BEGIN{srand(); print 1+int(255*rand())}' < /dev/null)
|
||||
|
||||
TESTS_ENVIRONMENT = \
|
||||
MALLOC_PERTURB_=$(random_val) \
|
||||
$(top_builddir)/run --test
|
||||
TESTS_ENVIRONMENT = $(top_builddir)/run --test
|
||||
|
||||
EXTRA_DIST = \
|
||||
$(TESTS)
|
||||
|
||||
@@ -20,10 +20,7 @@ include $(top_srcdir)/subdir-rules.mk
|
||||
TESTS = \
|
||||
test-charset-fidelity
|
||||
|
||||
random_val := $(shell awk 'BEGIN{srand(); print 1+int(255*rand())}' < /dev/null)
|
||||
|
||||
TESTS_ENVIRONMENT = \
|
||||
MALLOC_PERTURB_=$(random_val) \
|
||||
$(top_builddir)/run --test \
|
||||
$(VG)
|
||||
|
||||
|
||||
@@ -20,11 +20,7 @@ include $(top_srcdir)/subdir-rules.mk
|
||||
TESTS = \
|
||||
test-max-disks.pl
|
||||
|
||||
random_val := $(shell awk 'BEGIN{srand(); print 1+int(255*rand())}' < /dev/null)
|
||||
|
||||
TESTS_ENVIRONMENT = \
|
||||
MALLOC_PERTURB_=$(random_val) \
|
||||
$(top_builddir)/run --test
|
||||
TESTS_ENVIRONMENT = $(top_builddir)/run --test
|
||||
|
||||
EXTRA_DIST = \
|
||||
$(TESTS)
|
||||
|
||||
@@ -21,11 +21,7 @@ TESTS = \
|
||||
test-luks.sh \
|
||||
test-luks-list.sh
|
||||
|
||||
random_val := $(shell awk 'BEGIN{srand(); print 1+int(255*rand())}' < /dev/null)
|
||||
|
||||
TESTS_ENVIRONMENT = \
|
||||
MALLOC_PERTURB_=$(random_val) \
|
||||
$(top_builddir)/run --test
|
||||
TESTS_ENVIRONMENT = $(top_builddir)/run --test
|
||||
|
||||
EXTRA_DIST = \
|
||||
$(TESTS)
|
||||
|
||||
@@ -21,10 +21,7 @@ TESTS = \
|
||||
test-lvm-filtering.sh \
|
||||
test-lvm-mapping.pl
|
||||
|
||||
random_val := $(shell awk 'BEGIN{srand(); print 1+int(255*rand())}' < /dev/null)
|
||||
|
||||
TESTS_ENVIRONMENT = \
|
||||
MALLOC_PERTURB_=$(random_val) \
|
||||
$(top_builddir)/run --test
|
||||
|
||||
EXTRA_DIST = \
|
||||
|
||||
@@ -24,11 +24,7 @@ TESTS = \
|
||||
test-list-md-devices.sh \
|
||||
test-mdadm.sh
|
||||
|
||||
random_val := $(shell awk 'BEGIN{srand(); print 1+int(255*rand())}' < /dev/null)
|
||||
|
||||
TESTS_ENVIRONMENT = \
|
||||
MALLOC_PERTURB_=$(random_val) \
|
||||
$(top_builddir)/run --test
|
||||
TESTS_ENVIRONMENT = $(top_builddir)/run --test
|
||||
|
||||
EXTRA_DIST = \
|
||||
$(TESTS)
|
||||
|
||||
@@ -20,11 +20,7 @@ include $(top_srcdir)/subdir-rules.mk
|
||||
TESTS = \
|
||||
test-ntfsclone.sh
|
||||
|
||||
random_val := $(shell awk 'BEGIN{srand(); print 1+int(255*rand())}' < /dev/null)
|
||||
|
||||
TESTS_ENVIRONMENT = \
|
||||
MALLOC_PERTURB_=$(random_val) \
|
||||
$(top_builddir)/run --test
|
||||
TESTS_ENVIRONMENT = $(top_builddir)/run --test
|
||||
|
||||
EXTRA_DIST = \
|
||||
$(TESTS)
|
||||
|
||||
@@ -26,11 +26,7 @@ TESTS = \
|
||||
test-qemudie-midcommand.sh \
|
||||
test-qemudie-synch.sh
|
||||
|
||||
random_val := $(shell awk 'BEGIN{srand(); print 1+int(255*rand())}' < /dev/null)
|
||||
|
||||
TESTS_ENVIRONMENT = \
|
||||
MALLOC_PERTURB_=$(random_val) \
|
||||
$(top_builddir)/run --test
|
||||
TESTS_ENVIRONMENT = $(top_builddir)/run --test
|
||||
|
||||
EXTRA_DIST = \
|
||||
$(TESTS)
|
||||
|
||||
@@ -25,11 +25,7 @@ TESTS = \
|
||||
qemu-liveness.sh \
|
||||
qemu-snapshot-isolation.sh
|
||||
|
||||
random_val := $(shell awk 'BEGIN{srand(); print 1+int(255*rand())}' < /dev/null)
|
||||
|
||||
TESTS_ENVIRONMENT = \
|
||||
MALLOC_PERTURB_=$(random_val) \
|
||||
$(top_builddir)/run --test
|
||||
TESTS_ENVIRONMENT = $(top_builddir)/run --test
|
||||
|
||||
EXTRA_DIST = \
|
||||
$(TESTS)
|
||||
|
||||
@@ -34,10 +34,7 @@ TESTS = \
|
||||
tests_not_run = \
|
||||
rhbz727178.sh
|
||||
|
||||
random_val := $(shell awk 'BEGIN{srand(); print 1+int(255*rand())}' < /dev/null)
|
||||
|
||||
TESTS_ENVIRONMENT = \
|
||||
MALLOC_PERTURB_=$(random_val) \
|
||||
NOEXEC_CHECK="$(top_builddir)/src/.libs/libguestfs.so $(top_builddir)/daemon/guestfsd" \
|
||||
$(top_builddir)/run --test
|
||||
|
||||
|
||||
@@ -30,11 +30,7 @@ TESTS += \
|
||||
test-selinux-fuse.sh
|
||||
endif
|
||||
|
||||
random_val := $(shell awk 'BEGIN{srand(); print 1+int(255*rand())}' < /dev/null)
|
||||
|
||||
TESTS_ENVIRONMENT = \
|
||||
MALLOC_PERTURB_=$(random_val) \
|
||||
$(top_builddir)/run --test
|
||||
TESTS_ENVIRONMENT = $(top_builddir)/run --test
|
||||
|
||||
EXTRA_DIST = \
|
||||
run-test.pl \
|
||||
|
||||
@@ -31,17 +31,14 @@ libfakevirtxml_la_CFLAGS = $(LIBVIRT_CFLAGS)
|
||||
# -version-info and -rpath force libtool to build a shared library.
|
||||
libfakevirtxml_la_LDFLAGS = -version-info 0:0:0 -rpath /nowhere
|
||||
|
||||
random_val := $(shell awk 'BEGIN{srand(); print 1+int(255*rand())}' < /dev/null)
|
||||
|
||||
TESTS = \
|
||||
rhbz701814.pl
|
||||
|
||||
TESTS_ENVIRONMENT = \
|
||||
MALLOC_PERTURB_=$(random_val) \
|
||||
abs_srcdir=$(abs_srcdir) \
|
||||
LD_PRELOAD=.libs/libfakevirtxml.so \
|
||||
$(top_builddir)/run --test
|
||||
|
||||
TESTS = \
|
||||
rhbz701814.pl
|
||||
|
||||
endif
|
||||
|
||||
EXTRA_DIST = \
|
||||
|
||||
@@ -55,11 +55,7 @@ $(top_builddir)/html/virt-%.1.html: virt-%
|
||||
|
||||
# Tests.
|
||||
|
||||
random_val := $(shell awk 'BEGIN{srand(); print 1+int(255*rand())}' < /dev/null)
|
||||
|
||||
TESTS_ENVIRONMENT = \
|
||||
MALLOC_PERTURB_=$(random_val) \
|
||||
$(top_builddir)/run --test
|
||||
TESTS_ENVIRONMENT = $(top_builddir)/run --test
|
||||
|
||||
if ENABLE_APPLIANCE
|
||||
TESTS = test-virt-list-filesystems.sh \
|
||||
|
||||
Reference in New Issue
Block a user