[Libguestfs] [PATCH libguestfs] tests: increase likelihood that heap abuse triggers failure

Jim Meyering jim at meyering.net
Thu Aug 13 16:35:17 UTC 2009


This takes advantage of glibc's MALLOC_PERTURB_.
If you develop on glibc-based systems and don't yet set this via your
shell's init scripts, add something like this to e.g., .bashrc:

    export MALLOC_PERTURB_=$(($RANDOM % 255 + 1))

This change ensures that it's enabled for anyone running "make check"
and in particular for koji.

There's probably documentation somewhere, but I don't know where
off hand, so this will have to do:

    http://udrepper.livejournal.com/11429.html


>From e7ee94be7e929d8aa94e3e360d1d1ca3711dd01e Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering at redhat.com>
Date: Thu, 13 Aug 2009 18:29:59 +0200
Subject: [PATCH libguestfs] tests: increase likelihood that heap abuse triggers failure

* regressions/Makefile.am (TESTS_ENVIRONMENT): Always set
MALLOC_PERTURB_ to a random value in 1..255.
---
 regressions/Makefile.am |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/regressions/Makefile.am b/regressions/Makefile.am
index a51c76b..3279f95 100644
--- a/regressions/Makefile.am
+++ b/regressions/Makefile.am
@@ -40,7 +40,10 @@ SKIPPED_TESTS = \
 FAILING_TESTS = \
 	test-qemudie-launchfail.sh

+random_val := $(shell awk 'BEGIN{srand(); print 1+int(255*rand())}' < /dev/null)
+
 TESTS_ENVIRONMENT = \
+	MALLOC_PERTURB_=$(random_val) \
 	LD_LIBRARY_PATH=$(top_builddir)/src/.libs \
 	LIBGUESTFS_PATH=$(top_builddir)/appliance \
 	NOEXEC_CHECK="$(top_builddir)/src/.libs/libguestfs.so $(top_builddir)/daemon/guestfsd"
--
1.6.4.357.gfd68c




More information about the Libguestfs mailing list