https://bugs.kde.org/show_bug.cgi?id=518370

--- Comment #3 from Mark Wielaard <[email protected]> ---
So the issue is the assumption that any mmaped code has to retain the
(un)defined bits when someone makes it unaccessible (PROT_NONE) and accessible
again. And that memcheck cannot check accessiblity, but a SIGSEGV is "OK" - it
is kind of "OK" when the access is done by client code, but not when valgrind
does it, as seen in the syscall wrappers.

There is a test for this behaviour, memcheck/tests/addressable.vgtest.

But that is the only test that fails if we just do MC_(make_mem_noaccess)(a,
len); on mprotect NONE.

However the original bugs state that this is needed for wine (which I haven't
tests).

I wonder if we can detect if the mprotect NONE (or a guard page) is part of the
stack and change the "rules" a little.
It seems to me that if the page is part of the stack then we do want to
explicitly mark it as noaccess. And if it is made
accessible then we do want to mark it full undefined?

I quickly tried to see if we can find that out with AddrInfo from
pub_tool_addrinfo.h.

      AddrInfo ai;
      ai.tag = Addr_Undescribed;
      VG_(pp_addrinfo) ( a, &ai );
      if (ai.tag == Addr_Stack)
         MC_(make_mem_noaccess)(a, len);
      VG_(clear_addrinfo) (&ai);

But that never seems to describe a page as part of the stack.
Either I don't have a good testcase, or we don't yet know if the page is part
of the stack when track_change_mem_mprotect is called.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to