This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] hppa: avoid NULL dereference of sym_map in elf_machine_rela()
- From: Aaro Koskinen <aaro dot koskinen at iki dot fi>
- To: Roland McGrath <roland at hack dot frob dot com>
- Cc: Carlos O'Donell <carlos at redhat dot com>, GNU C Library <libc-alpha at sourceware dot org>, John David Anglin <dave dot anglin at bell dot net>
- Date: Sat, 1 Nov 2014 00:38:01 +0200
- Subject: Re: [PATCH] hppa: avoid NULL dereference of sym_map in elf_machine_rela()
- Authentication-results: sourceware.org; auth=none
- References: <1414791231-30990-1-git-send-email-aaro dot koskinen at iki dot fi> <20141031214255 dot 8FFB12C3ACC at topped-with-meat dot com>
On Fri, Oct 31, 2014 at 02:42:55PM -0700, Roland McGrath wrote:
> It's likely this is not the right fix. Unless there is a test case where
> any of those paths can actually dereference a null pointer, then we do not
> want to insert those checks.
Ok, let's call it a quick hack/workaround then.
> Rather, the right solution is probably to find (or add) some switch to GCC
> that changes what it emits from being a call to abort to be something
> different. It's possible that abort is OK and we just need to define an
> appropriately minimal abort in rtld. But it needs to be looked into.
The other quick workaround I could find is -fno-delete-null-pointer-checks.
"[...] other optimization passes in GCC use this flag to control global
dataflow analyses that eliminate useless checks for null pointers [...]"
So this also fixes the PA-RISC build:
diff --git a/elf/Makefile b/elf/Makefile
index 3036b9b..f5fee93 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -46,6 +46,7 @@ shared-only-routines += dl-caller
rtld-routines := rtld $(dl-routines) dl-sysdep dl-environ dl-minimal
all-rtld-routines = $(rtld-routines) $(sysdep-rtld-routines)
+CFLAGS-dl-conflict.c = -fno-delete-null-pointer-checks
CFLAGS-dl-runtime.c = -fexceptions -fasynchronous-unwind-tables
CFLAGS-dl-lookup.c = -fexceptions -fasynchronous-unwind-tables
CFLAGS-dl-iterate-phdr.c = $(uses-callbacks)
A.