Jim Meyering
2009-Aug-13 16:35 UTC
[Libguestfs] [PATCH libguestfs] tests: increase likelihood that heap abuse triggers failure
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
Richard W.M. Jones
2009-Aug-13 16:36 UTC
[Libguestfs] [PATCH libguestfs] tests: increase likelihood that heap abuse triggers failure
On Thu, Aug 13, 2009 at 06:35:17PM +0200, Jim Meyering wrote:> 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.gfd68cACK. Rich. -- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into Xen guests. http://et.redhat.com/~rjones/virt-p2v
Reasonably Related Threads
- [PATCH] Prepend local library path to LD_LIBRARY_PATH for tests, instead of replacing it
- [PATCH] Do not run test-virt-format.sh if appliance has not been built
- Various fixes from building libguestfs for Debian
- [PATCH 3/3] export MALLOC_PERTURB_ and MALLOC_CHECK_ in test suite
- [PATCH libguestfs 1/2] build: Allow C programs using libguestfs to be compiled against build dir.