i386 memory fence incompatible with valgrind

Matthias Urlichs matthias at urlichs.de
Sat Jan 14 19:06:44 CET 2017


On 14.01.2017 17:52, Marc Lehmann wrote:
> That is, sorry to say, utter bullshit. If the kernel unmaps that page
> and returns to the userland, it would crash on the next stack allocation
> as well.
No it would not, because the kernel would notice that the access in
question, unlike yours is *not* below the stack pointer, because the CPU
first decrements the stack pointer and then tries to store something
there. The kernel would therefore just extend the stack downwards. A
memory checker would do the exact same thing.

In any case, I'd assume that the main author of a tool like valgrind
knows a whole damn lot about this stuff. Bullshit? not so much, IMHO. If
I wanted to call bullshit, which I'm not, I'd start with your assertion
that the -1 is to be found in the kernel.

No, it's not your job to improve valgrind, but it's both your and the
valgrind author's job to get the two to play nicely with each other.
Given that each of you thinks that the other is mistaken (NB: for what
it's worth, Julian didn't call "utter bullshit"), it's still a whole lot
easier to replace a single -1 with zero than to teach valgrind about
possibly-or-not legal accesses below the stack.

-- 
-- Matthias Urlichs




More information about the libev mailing list