[GHC] #8402: throwTo segfaults under -prof -threaded -with-rtsopts=N2
GHC
ghc-devs
Thu Oct 3 17:52:29 UTC 2013
#8402: throwTo segfaults under -prof -threaded -with-rtsopts=N2
----------------------------------+----------------------------------
Reporter: akio | Owner:
Type: bug | Status: patch
Priority: highest | Milestone: 7.8.1
Component: Profiling | Version: 7.7
Resolution: | Keywords:
Operating System: Linux | Architecture: x86_64 (amd64)
Type of failure: Runtime crash | Difficulty: Unknown
Test Case: | Blocked By:
Blocking: | Related Tickets:
----------------------------------+----------------------------------
Comment (by ezyang):
OK, I understand what is going on here. It useful to think of the various
cases that the RTS can be compiled. When the RTS is compiled as profiling
and debugging, some of the sanity check code expects closures to be zeroed
(specifically checkFullHeap, which explicitly looks for slop like things):
{{{
/* skip over slop */
while (p < bd->free &&
(*p < 0x1000 || !LOOKS_LIKE_INFO_PTR(*p))) { p++; }
}}}
So we must zero out the slop in that case.
However, when RTS is compiled as profiling and multithreaded, as Simon
points out (and I didn't realize when making my patch), it's not OK to
zero slop when threaded. So Akio's patch prevents the slop from zeroed in
this case.
Serendipitously, we already had disabled full heap checks when compiling
with the threaded RTS. So I think the proper conditional here is:
{{{
// It is never valid to overwrite slop when multithreaded
#if defined(THREADED_RTS)
return;
// We need to overwrite slop when:
// - We are LDV profiling
// - We have a debug RTS which will do full heap checks
#elif defined(PROFILING) && !DEBUG
if (era <= 0) return;
#endif
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8402#comment:6>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list