https://bugs.kde.org/show_bug.cgi?id=436626
Bug ID: 436626
Summary: Increase the limit for --ignore-range-below-sp
Product: valgrind
Version: unspecified
Platform: unspecified
OS: Linux
Status: REPORTED
Severity: normal
Priority: NOR
Component: memcheck
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: ---
My aim is to make Valgrind work with Java in order to track native (non-java)
memory leaks. I have succeeded already, but that required one patch to
Valgrind.
Namely, the allowed range for '--ignore-range-below-sp' needs to be increased.
Java has an internal Just-In-Time compiler which translates Java bytecode into
native code. It also injects stack probes in lots of compiled methods, see [1].
The result is that valgrind sees "Invalid write of size 4 <...> bytes below
stack pointer" in thousands of different locations.
On top of that, because methods are compiled with JIT, Valgrdind doesn't have
any debug info for them, so suppressing them by stack is hard. Wildcard
suppression is possible, but this still makes valgrind a lot slower, because it
keeps/processes thousands of encountered errors even though they are
suppressed.
Solution is simple: in 'mc_main.c', delete the following lines:
--------
if (offs1 - offs2 > 4096 /*arbitrary*/) {
VG_(message)(Vg_DebugMsg,
"ERROR: --ignore-range-below-sp: suspiciously large "
"range: %u-%u (size %u)\n", offs1, offs2, offs1 - offs2);
return False;
}
--------
Note that a few lines above, both values are checked to not exceed (1000*1000).
Removing those lines allows to set a range of (1000*1000), effectively
disabling the test for writes below stack pointer. Unfortunately, there is no
better solution for Java, it seems.
[1]
https://github.com/openjdk/jdk/blob/739769c8fc4b496f08a92225a12d07414537b6c0/src/hotspot/share/asm/assembler.cpp#L123
--
You are receiving this mail because:
You are watching all bug changes.