Skip to content

Commit 2011037

Browse files
committed
run: Use GLIBC_TUNABLES instead of MALLOC_PERTURB_
glibc 2.34 removed MALLOC_CHECK_ and MALLOC_PERTURB_ and replaced them with GLIBC_TUNABLES with a completely different syntax and requiring a special library (libc_malloc_debug.so.0) to be preloaded. Note this works even if the preloaded library is not present since ld.so ignores missing LD_PRELOAD. So this shouldn't break anything either for older glibc or if the special library is missing. (cherry picked from virt-v2v commit 9f54a4063ddcda91a7bb965c343178da419a8726)
1 parent 8858fc6 commit 2011037

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

run.in

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,9 @@ fi
103103
# This is a cheap way to find some use-after-free and uninitialized
104104
# read problems when using glibc.
105105
random_val="$(@AWK@ 'BEGIN{srand(); print 1+int(255*rand())}' < /dev/null)"
106-
export MALLOC_PERTURB_=$random_val
106+
LD_PRELOAD="${LD_PRELOAD:+"$LD_PRELOAD:"}libc_malloc_debug.so.0"
107+
GLIBC_TUNABLES=glibc.malloc.check=1:glibc.malloc.perturb=$random_val
108+
export LD_PRELOAD GLIBC_TUNABLES
107109

108110
# Do we have libtool? If we have it then we can use it to make
109111
# running valgrind simpler. However don't depend on it.

0 commit comments

Comments
 (0)