summaryrefslogtreecommitdiff
path: root/alloc.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2023-05-16 07:30:25 +0300
committerIvan Maidanski <ivmai@mail.ru>2023-05-16 11:31:05 +0300
commit0a65033c4adb39fa64583d732564abeec949db43 (patch)
tree15062aa6330023c8c382b97fe66b185f63b820ed /alloc.c
parent18e5b12da8d638a4d567c2f888201a4fc86c9c64 (diff)
downloadbdwgc-0a65033c4adb39fa64583d732564abeec949db43.tar.gz
Fix overlapping region assertion in mark_some if malloc redirect on Linux
* alloc.c [SET_REAL_HEAP_BOUNDS && INCLUDE_LINUX_THREAD_DESCR] (GC_add_to_heap): If endp is greater than GC_greatest_real_heap_addr then add [p,endp) region to the data roots exclusions; add comment. * include/private/gc_priv.h [INCLUDE_LINUX_THREAD_DESCR] (SET_REAL_HEAP_BOUNDS, GC_least_real_heap_addr, GC_greatest_real_heap_addr): Define.
Diffstat (limited to 'alloc.c')
-rw-r--r--alloc.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/alloc.c b/alloc.c
index ef20d426..abd5d228 100644
--- a/alloc.c
+++ b/alloc.c
@@ -1438,8 +1438,13 @@ STATIC void GC_add_to_heap(struct hblk *p, size_t bytes)
if ((word)p < GC_least_real_heap_addr
|| EXPECT(0 == GC_least_real_heap_addr, FALSE))
GC_least_real_heap_addr = (word)p - sizeof(word);
- if (endp > GC_greatest_real_heap_addr)
+ if (endp > GC_greatest_real_heap_addr) {
+# ifdef INCLUDE_LINUX_THREAD_DESCR
+ /* Avoid heap intersection with the static data roots. */
+ GC_exclude_static_roots_inner((void *)p, (void *)endp);
+# endif
GC_greatest_real_heap_addr = endp;
+ }
# endif
if (EXPECT(old_capacity > 0, FALSE)) {
# ifndef GWW_VDB