From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/6441 Path: news.gmane.org!not-for-mail From: Timo Teras Newsgroups: gmane.linux.lib.musl.general Subject: Re: fixing -fPIE + -fstack-protector-all Date: Wed, 5 Nov 2014 18:01:40 +0200 Message-ID: <20141105180140.5d98fee9@vostro> References: <545A414F.8000407@barfooze.de> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1415203365 25133 80.91.229.3 (5 Nov 2014 16:02:45 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 5 Nov 2014 16:02:45 +0000 (UTC) Cc: musl@lists.openwall.com, Gregor Richards To: John Spencer Original-X-From: musl-return-6454-gllmg-musl=m.gmane.org@lists.openwall.com Wed Nov 05 17:02:39 2014 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1Xm32a-0005Zr-L7 for gllmg-musl@m.gmane.org; Wed, 05 Nov 2014 17:02:36 +0100 Original-Received: (qmail 20119 invoked by uid 550); 5 Nov 2014 16:02:35 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 20109 invoked from network); 5 Nov 2014 16:02:35 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=KXmrhfXoeAM/iocDAeva46TQwl3fLR9vo09sMIFzqbA=; b=bn7b8QaSJCNdUlrJf3AudEJmV/eLaDEE0NAFJlGtSiumTBPP4U2tIYmR4TrsJFdS02 MND7mUJm0jGliLUno6OS4AsCupDhewJJVA9S1vC05M7rX9ddSBTP+Ltb+WW8M32o5bQS yfv+ahxzKAf2XAck2B1Q8l+q61o6Z0AqR2RE24UuP8iVpGFgVzJTIjYU8aDyPU7Tl5o6 RYfSVyedjrTPozTJbN0S9x+LwniHSlaXnExfHHyWdGRyE5Ja6iF41azTVXnhzl2UCNjf h2KusqCJ4ntsxMSCcJXJlC4XYuPWJ38ZLGSseeekx+u2T8oROeMLbKYSXzQ/F81mVj3C HJxQ== X-Received: by 10.152.28.101 with SMTP id a5mr70085340lah.52.1415203340725; Wed, 05 Nov 2014 08:02:20 -0800 (PST) Original-Sender: =?UTF-8?Q?Timo_Ter=C3=A4s?= In-Reply-To: <545A414F.8000407@barfooze.de> X-Mailer: Claws Mail 3.10.1 (GTK+ 2.24.23; x86_64-alpine-linux-musl) Xref: news.gmane.org gmane.linux.lib.musl.general:6441 Archived-At: On Wed, 05 Nov 2014 16:25:03 +0100 John Spencer wrote: > using -fPIE + -fstack-protector-all is currently broken for a number > of architectures (most notably i386) in the default gcc setup > (including the musl-cross patches), as it depends on a > libssp_nonshared.a which provides __stack_chk_fail_local(). In Alpine Linux we are patching gcc to unconditionally to have -lssp_nonshared: http://git.alpinelinux.org/cgit/aports/tree/main/gcc/gcc-4.8-musl-libssp.patch And making musl package provide that library: http://git.alpinelinux.org/cgit/aports/tree/main/musl/__stack_chk_fail_local.c http://git.alpinelinux.org/cgit/aports/tree/main/musl/APKBUILD#n60 This is for two reasons: 1. gcc bootstrap is broken if it's to be compiled with -fstack-protector otherwise 2. Linking without "-fstack-protector" flag with .a or .o files that have been compiled with SSP would break. Basically, __stack_chk_fail_local symbol should be provided always. Agreeably gcc should emit 'hlt' or similar instead of that function call. Or at least provide implementation for that function with 'once' linking. /Timo