From patchwork Fri Oct 31 22:38:01 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaro Koskinen X-Patchwork-Id: 405703 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id D9108140100 for ; Sat, 1 Nov 2014 09:38:18 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:cc:subject:message-id:references :mime-version:content-type:in-reply-to; q=dns; s=default; b=ruLa FQ0ZftkJIwONIyLm5x/c2E2AUnLi0LPMCUppNe12e2cBG8BVsNumNYX7MlWOBS0G ygx1yqceNz807ejFKy4jAebUzx9HNy5DXZAV5PHildMGcg+HYtztP3KdazVfQeMT IzH8KLslCNiF/RxqRcE98CEAGTau9FewlEqczug= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:cc:subject:message-id:references :mime-version:content-type:in-reply-to; s=default; bh=unLPwW1Aaw MYKtF+11rrs1rnKUI=; b=v+PCpYodBkSV/c3oTX0X8J0sdFEorgd4SazRXz0oSC htuKU4jnM4CJ2YA9ysBO6ZJUlzXlnkKKicBM4L0ereEsouhvGNIl4qZrxRC8D59Q 7wQWc6G3E8RHbkuxhiXRUK9NRWZPQQjsUne77BQPE89baP2w3drTDmFQiXeAzBXY U= Received: (qmail 32522 invoked by alias); 31 Oct 2014 22:38:13 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 32511 invoked by uid 89); 31 Oct 2014 22:38:12 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, SPF_NEUTRAL autolearn=no version=3.3.2 X-HELO: filtteri1.pp.htv.fi Date: Sat, 1 Nov 2014 00:38:01 +0200 From: Aaro Koskinen To: Roland McGrath Cc: Carlos O'Donell , GNU C Library , John David Anglin Subject: Re: [PATCH] hppa: avoid NULL dereference of sym_map in elf_machine_rela() Message-ID: <20141031223801.GA17511@drone.musicnaut.iki.fi> References: <1414791231-30990-1-git-send-email-aaro.koskinen@iki.fi> <20141031214255.8FFB12C3ACC@topped-with-meat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20141031214255.8FFB12C3ACC@topped-with-meat.com> User-Agent: Mutt/1.5.23 (2014-03-12) 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: A. 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)