rts: Claim AP_STACK before adjusting Sp
ClosedPublic

Authored by bgamari on Jul 19 2017, 4:05 PM.

Details

Summary

In the fix to Trac #13615 we introduced some logic to atomically blackhole AP_STACKs
closures upon entry. However, this logic was placed *after* a stack pointer
adjustment. This meant that if someone else beat us to blackholing the AP_STACK
we would suspend the thread with uninitialized content on the stack. This would
then later blow up when threadPaused attempted to walk the stack, hence Trac #13970.

Silly bug but still cost lots of head-scratching to find.

Thanks to albertov for the great repro.

Fixes Trac #13970. Bug originally introduced by the fix to Trac #13615.

Diff Detail

Repository
rGHC Glasgow Haskell Compiler
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
bgamari created this revision.Jul 19 2017, 4:05 PM
bgamari updated the Trac tickets for this revision.Jul 19 2017, 4:49 PM
bgamari edited the summary of this revision. (Show Details)
bgamari edited the summary of this revision. (Show Details)Jul 19 2017, 9:07 PM
erikd accepted this revision.Jul 20 2017, 12:57 AM

LGTM!

This revision is now accepted and ready to land.Jul 20 2017, 12:57 AM
hvr awarded a token.Jul 20 2017, 3:31 AM
This revision was automatically updated to reflect the committed changes.