diff options
author | Ben Gamari <ben@smart-cactus.org> | 2022-04-04 21:43:27 -0400 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-04-25 10:20:05 -0400 |
commit | e09afbf2a998beea7783e3de5dce5dd3c6ff23db (patch) | |
tree | 126afde30070ef8a13cee9a558eb1f5192b5c1ea /utils | |
parent | 41cf758b3f50554e0aa5240a5898b693758d9670 (diff) | |
download | haskell-e09afbf2a998beea7783e3de5dce5dd3c6ff23db.tar.gz |
rts: Refactor handling of dead threads' stacks
This fixes a bug that @JunmingZhao42 and I noticed while working on her
MMTK port. Specifically, in stg_stop_thread we used stg_enter_info as a
sentinel at the tail of a stack after a thread has completed. However,
stg_enter_info expects to have a two-field payload, which we do not
push. Consequently, if the GC ends up somehow the stack it will attempt
to interpret data past the end of the stack as the frame's fields,
resulting in unsound behavior.
To fix this I eliminate this hacky use of `stg_stop_thread` and instead
introduce a new stack frame type, `stg_dead_thread_info`. Not only does
this eliminate the potential for the previously mentioned memory
unsoundness but it also more clearly captures the intended structure of
the dead threads' stacks.
Diffstat (limited to 'utils')
-rw-r--r-- | utils/deriveConstants/Main.hs | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/utils/deriveConstants/Main.hs b/utils/deriveConstants/Main.hs index 9a57ecf682..1619f5588c 100644 --- a/utils/deriveConstants/Main.hs +++ b/utils/deriveConstants/Main.hs @@ -421,6 +421,7 @@ wanteds os = concat ,closureSize Both "StgUpdateFrame" ,closureSize C "StgCatchFrame" ,closureSize C "StgStopFrame" + ,closureSize C "StgDeadThreadFrame" ,closureSize Both "StgMutArrPtrs" ,closureField Both "StgMutArrPtrs" "ptrs" |