diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2021-09-19 13:23:22 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2021-09-19 22:10:00 +0300 |
commit | e638c52c3dc6cf5dcf8ccc48155763622d29b8b5 (patch) | |
tree | f75bb7b7f4134dec58331141f8aef93a21ce5d65 | |
parent | 24e50d19c84ce7089cc9e9f80be924979e29d147 (diff) | |
download | bdwgc-e638c52c3dc6cf5dcf8ccc48155763622d29b8b5.tar.gz |
Fix assertion violation in register_dynlib_callback on Android
(a cherry-pick of commit 3cbd5ec35 from 'release-7_4')
* 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.
-rw-r--r-- | dyn_load.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -467,11 +467,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 seg\n",0); } else { - GC_ASSERT(end <= 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; } |