diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2023-05-16 07:30:25 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2023-05-16 11:31:05 +0300 |
commit | 0a65033c4adb39fa64583d732564abeec949db43 (patch) | |
tree | 15062aa6330023c8c382b97fe66b185f63b820ed | |
parent | 18e5b12da8d638a4d567c2f888201a4fc86c9c64 (diff) | |
download | bdwgc-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.
-rw-r--r-- | alloc.c | 7 | ||||
-rw-r--r-- | include/private/gc_priv.h | 1 |
2 files changed, 7 insertions, 1 deletions
@@ -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 diff --git a/include/private/gc_priv.h b/include/private/gc_priv.h index dc442afb..be5ee98c 100644 --- a/include/private/gc_priv.h +++ b/include/private/gc_priv.h @@ -1449,6 +1449,7 @@ struct _GC_arrays { /* Used by GC_register_dynamic_libraries(). */ # endif # if defined(GC_ASSERTIONS) || defined(MAKE_BACK_GRAPH) \ + || defined(INCLUDE_LINUX_THREAD_DESCR) \ || (defined(KEEP_BACK_PTRS) && ALIGNMENT == 1) # define SET_REAL_HEAP_BOUNDS # define GC_least_real_heap_addr GC_arrays._least_real_heap_addr |