diff options
author | Matt Caswell <matt@openssl.org> | 2022-02-24 16:20:14 +0000 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2022-03-03 13:36:21 +0000 |
commit | c1b364cee39029e7c37ea97804d22c248a40d582 (patch) | |
tree | d3a64282eef4ca357befcf7166f7dfede4fd7162 | |
parent | 0176fc78d090210cd7e231a7c2c4564464509506 (diff) |
Perturb the malloc output during tests
Set the environment variable MALLOC_PERTURB_ during tests to perturb the
output from OPENSSL_malloc() calls (see the mallopt man page for details
about this environment variable). This could be a low cost way of spotting
uninit reads in "make test" runs in some situations.
In tests I have found it to be a little unreliable (sometimes it seemed to
not perturb the output for inexplicable reasons) - but since this is easy
to implement I think it is worthwhile.
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17768)
-rw-r--r-- | test/run_tests.pl | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/test/run_tests.pl b/test/run_tests.pl index 4899356a6e..4ee6a036a9 100644 --- a/test/run_tests.pl +++ b/test/run_tests.pl @@ -39,6 +39,11 @@ $ENV{OPENSSL_MODULES} = rel2abs(catdir($bldtop, "providers")); $ENV{OPENSSL_ENGINES} = rel2abs(catdir($bldtop, "engines")); $ENV{CTLOG_FILE} = rel2abs(catfile($srctop, "test", "ct", "log_list.cnf")); +# On platforms that support this, this will ensure malloc returns data that is +# set to a non-zero value. Can be helpful for detecting uninitialized reads in +# some situations. +$ENV{'MALLOC_PERTURB_'} = '128' if !defined $ENV{'MALLOC_PERTURB_'}; + my %tapargs = ( verbosity => $ENV{HARNESS_VERBOSE} ? 1 : 0, lib => [ $libdir ], |