From patchwork Thu Dec 15 14:15:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nix X-Patchwork-Id: 18479 Received: (qmail 22367 invoked by alias); 15 Dec 2016 14:16:41 -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 22268 invoked by uid 89); 15 Dec 2016 14:16:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.6 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=Hx-languages-length:1768 X-HELO: mail.esperi.org.uk From: Nix To: Florian Weimer Cc: libc-alpha@sourceware.org, Adhemerval Zanella Subject: Re: [PATCH 08/12] De-PLTize __stack_chk_fail internal calls within libc.so. References: <20161128123228.30856-1-nix@esperi.org.uk> <20161128123228.30856-9-nix@esperi.org.uk> Date: Thu, 15 Dec 2016 14:15:43 +0000 In-Reply-To: (Florian Weimer's message of "Thu, 15 Dec 2016 14:56:21 +0100") Message-ID: <87y3zhjn1s.fsf@esperi.org.uk> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.94 (gnu/linux) MIME-Version: 1.0 X-DCC--Metrics: spindle 1480; Body=3 Fuz1=3 Fuz2=3 On 15 Dec 2016, Florian Weimer said: > On 11/28/2016 01:32 PM, Nix wrote: >> From: Adhemerval Zanella [...] >> diff --git a/sysdeps/generic/symbol-hacks.h b/sysdeps/generic/symbol-hacks.h >> index ce576c9..36908b5 100644 >> --- a/sysdeps/generic/symbol-hacks.h >> +++ b/sysdeps/generic/symbol-hacks.h >> @@ -4,4 +4,8 @@ >> asm ("memmove = __GI_memmove"); >> asm ("memset = __GI_memset"); >> asm ("memcpy = __GI_memcpy"); >> + >> +/* -fstack-protector generates calls to __stack_chk_fail, which need >> + similar adjustments to avoid going through the PLT. */ >> +asm ("__stack_chk_fail = __stack_chk_fail_local"); >> #endif > > We should do this only if we compile glibc with stack protector support enabled, and disable this for the files which we compile > without stack protector. I hope this will fix an assembler error while compiling __stack_chk_fail.c on ia64: I don't think we need to disable it for *all* such files -- but at the very least it must be disabled for debug/stack_chk_fail.c, and if we're doing that it's probably easier to do as you suggest (though it's invasive enough I'll have to kick another test cycle off, sigh). Possible fix, untested: diff --git a/sysdeps/generic/symbol-hacks.h b/sysdeps/generic/symbol-hacks.h index 36908b5..0679354 100644 --- a/sysdeps/generic/symbol-hacks.h +++ b/sysdeps/generic/symbol-hacks.h @@ -7,5 +7,7 @@ asm ("memcpy = __GI_memcpy"); /* -fstack-protector generates calls to __stack_chk_fail, which need similar adjustments to avoid going through the PLT. */ +#if defined __SSP__ || defined __SSP_ALL__ || defined __SSP_STRONG__ asm ("__stack_chk_fail = __stack_chk_fail_local"); #endif +#endif