[Git][ghc/ghc][master] rts: avoid checking bdescr of value outside of Haskell heap
Marge Bot (@marge-bot)
gitlab at gitlab.haskell.org
Thu Feb 29 07:10:40 UTC 2024
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
74b24a9b by Teo Camarasu at 2024-02-28T16:32:58+00:00
rts: avoid checking bdescr of value outside of Haskell heap
In nonmovingTidyWeaks we want to check if the key of a weak pointer
lives in the non-moving heap. We do this by checking the flags of the
block the key lives in. But we need to be careful with values that live
outside the Haskell heap, since they will lack a block descriptor and
looking for one may lead to a segfault. In this case we should just
accept that it isn't on the non-moving heap.
Resolves #24492
- - - - -
1 changed file:
- rts/sm/NonMovingMark.c
Changes:
=====================================
rts/sm/NonMovingMark.c
=====================================
@@ -2011,7 +2011,7 @@ bool nonmovingTidyWeaks (struct MarkQueue_ *queue)
// See Note [Weak pointer processing and the non-moving GC] in
// MarkWeak.c
- bool key_in_nonmoving = Bdescr((StgPtr) w->key)->flags & BF_NONMOVING;
+ bool key_in_nonmoving = HEAP_ALLOCED_GC(w->key) && Bdescr((StgPtr) w->key)->flags & BF_NONMOVING;
if (!key_in_nonmoving || nonmovingIsNowAlive(w->key)) {
nonmovingMarkLiveWeak(queue, w);
did_work = true;
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/74b24a9b0084459b8aa426a502956bd332b4d0fb
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/74b24a9b0084459b8aa426a502956bd332b4d0fb
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20240229/f10057f0/attachment.html>
More information about the ghc-commits
mailing list