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.
This commit is contained in:
Jason Evans 2016-10-12 22:58:40 -07:00
parent d419bb09ef
commit a2539fab95

View File

@ -1161,9 +1161,20 @@ malloc_conf_init(void)
if (config_fill) { if (config_fill) {
if (CONF_MATCH("junk")) { if (CONF_MATCH("junk")) {
if (CONF_MATCH_VALUE("true")) { if (CONF_MATCH_VALUE("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 = "true";
opt_junk_alloc = opt_junk_free = opt_junk_alloc = true;
true; opt_junk_free = true;
}
} else if (CONF_MATCH_VALUE("false")) { } else if (CONF_MATCH_VALUE("false")) {
opt_junk = "false"; opt_junk = "false";
opt_junk_alloc = opt_junk_free = opt_junk_alloc = opt_junk_free =
@ -1173,9 +1184,20 @@ malloc_conf_init(void)
opt_junk_alloc = true; opt_junk_alloc = true;
opt_junk_free = false; opt_junk_free = false;
} else if (CONF_MATCH_VALUE("free")) { } else if (CONF_MATCH_VALUE("free")) {
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 = "free";
opt_junk_alloc = false; opt_junk_alloc = false;
opt_junk_free = true; opt_junk_free = true;
}
} else { } else {
malloc_conf_error( malloc_conf_error(
"Invalid conf value", k, "Invalid conf value", k,