diff options
author | Jason Evans <jasone@canonware.com> | 2016-10-12 22:58:40 -0700 |
---|---|---|
committer | Jason Evans <jasone@canonware.com> | 2016-10-12 22:58:40 -0700 |
commit | a2539fab95008bee7fc1e4651d24b6a0427b88ce (patch) | |
tree | e23ee39996c65a659682fc3bd547e35a15ff5dc5 | |
parent | d419bb09ef6700dde95c74e1f1752f81e5d15d92 (diff) | |
download | jemalloc-a2539fab95008bee7fc1e4651d24b6a0427b88ce.tar.gz |
Disallow 0x5a junk filling when running in Valgrind.
Explicitly disallow junk:true and junk:free runtime settings when
running in Valgrind, since deallocation-time junk filling and redzone
validation cause false positive Valgrind reports.
This resolves #470.
-rw-r--r-- | src/jemalloc.c | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/src/jemalloc.c b/src/jemalloc.c index d3bb596d..8731934f 100644 --- a/src/jemalloc.c +++ b/src/jemalloc.c @@ -1161,9 +1161,20 @@ malloc_conf_init(void) if (config_fill) { if (CONF_MATCH("junk")) { if (CONF_MATCH_VALUE("true")) { - opt_junk = "true"; - opt_junk_alloc = opt_junk_free = - true; + if (config_valgrind && + unlikely(in_valgrind)) { + malloc_conf_error( + "Deallocation-time " + "junk filling cannot " + "be enabled while " + "running inside " + "Valgrind", k, klen, v, + vlen); + } else { + opt_junk = "true"; + opt_junk_alloc = true; + opt_junk_free = true; + } } else if (CONF_MATCH_VALUE("false")) { opt_junk = "false"; opt_junk_alloc = opt_junk_free = @@ -1173,9 +1184,20 @@ malloc_conf_init(void) opt_junk_alloc = true; opt_junk_free = false; } else if (CONF_MATCH_VALUE("free")) { - opt_junk = "free"; - opt_junk_alloc = false; - opt_junk_free = true; + if (config_valgrind && + unlikely(in_valgrind)) { + malloc_conf_error( + "Deallocation-time " + "junk filling cannot " + "be enabled while " + "running inside " + "Valgrind", k, klen, v, + vlen); + } else { + opt_junk = "free"; + opt_junk_alloc = false; + opt_junk_free = true; + } } else { malloc_conf_error( "Invalid conf value", k, |