summaryrefslogtreecommitdiff
path: root/dyn_load.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2021-09-19 13:23:22 +0300
committerIvan Maidanski <ivmai@mail.ru>2021-09-19 14:29:41 +0300
commiteed7e2372fed90a97b079a1fe26e65a6867dc836 (patch)
tree1a67846fad9aa6da9c7bc01c66fd5458cadb5f12 /dyn_load.c
parentbc26e5debad671693f52f721535cf4ac7927856e (diff)
downloadbdwgc-eed7e2372fed90a97b079a1fe26e65a6867dc836.tar.gz
Fix assertion violation in register_dynlib_callback on Android
* dyn_load.c [HAVE_DL_ITERATE_PHDR && PT_GNU_RELRO] (GC_register_dynlib_callback): Round load_segs[j].end up to nearest page boundary in the assertion; add comment.
Diffstat (limited to 'dyn_load.c')
-rw-r--r--dyn_load.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/dyn_load.c b/dyn_load.c
index e1beb367..dbfd1245 100644
--- a/dyn_load.c
+++ b/dyn_load.c
@@ -542,11 +542,15 @@ STATIC int GC_register_dynlib_callback(struct dl_phdr_info * info,
if (load_segs[j].start2 != 0) {
WARN("More than one GNU_RELRO segment per load one\n",0);
} else {
- GC_ASSERT((word)end <= (word)load_segs[j].end);
+ GC_ASSERT((word)end <=
+ (((word)load_segs[j].end + GC_page_size - 1) &
+ ~(GC_page_size - 1)));
/* Remove from the existing load segment */
load_segs[j].end2 = load_segs[j].end;
load_segs[j].end = start;
load_segs[j].start2 = end;
+ /* Note that start2 may be greater than end2 because of */
+ /* p->p_memsz value multiple of page size. */
}
break;
}