From 7f3b5bc1cf14b6d17f3c4dd218fa88fc07be339a Mon Sep 17 00:00:00 2001 From: Kjetil Matheussen Date: Fri, 15 Jul 2016 14:00:26 +0200 Subject: [PATCH] Do not warn of missing PT_GNU_RELRO segment when custom DSO filter used It is most likely that it is not found just because the segment had been excluded. Alternatively, we could have registered all segments, and checked the callback afterwards, but then we could break programs that rely on GC_has_static_roots_func to avoid overflowing the maximum number of roots. In addition, it would make the logic slightly more complicated, probably without a very good reason since the chance of this warning to show without the segment being excluded is likely to be none. * dyn_load.c [HAVE_DL_ITERATE_PHDR] (GC_register_dynlib_callback): Do not call WARN() if GC_has_static_roots callback is set. --- dyn_load.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dyn_load.c b/dyn_load.c index b3ecde86..cc4a1c4e 100644 --- a/dyn_load.c +++ b/dyn_load.c @@ -506,8 +506,11 @@ STATIC int GC_register_dynlib_callback(struct dl_phdr_info * info, } break; } - if (j == 0) WARN("Failed to find PT_GNU_RELRO segment" - " inside PT_LOAD region\n", 0); + if (0 == j && 0 == GC_has_static_roots) + WARN("Failed to find PT_GNU_RELRO segment" + " inside PT_LOAD region\n", 0); + /* No warning reported in case of the callback is present */ + /* because most likely the segment has been excluded. */ } } -- 2.40.0