
#14346: 8.2.1 regression: heap corruption after safe foreign calls
-------------------------------------+-------------------------------------
Reporter: andrewchen | Owner: (none)
Type: bug | Status: infoneeded
Priority: highest | Milestone:
Component: Runtime System | Version: 8.2.1
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: Runtime crash | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by bgamari):
I could have sworn I left a comment last night but it seems I am mistaken.
Here is what I discovered while looking into this so far:
The test is indeed rather environment sensitive. Moreover, as it doesn't
occur under `rr` I strongly suspect it's a race of some sort. When
compiled with `-debug` the eventual segmentation fault always seems to
occur in `stg_putMVarzh`. Specifically here,
{{{
Dump of assembler code for function stg_putMVarzh:
0x00000000004ab1b0 <+0>: cmpl $0x1,0x4f4800
0x00000000004ab1b8 <+8>: je 0x4ab35e
print/a $rbx $1 = 0x42000b8400 print/a $rdx $2 = 0x42deadbeef }}} Yikes!
This sounds to me like we reentered STG while forgetting to do some bit of cleanup from the foreign call. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14346#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler