From patchwork Wed Mar 2 22:16:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 63426 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp2622929lbc; Wed, 2 Mar 2016 14:16:52 -0800 (PST) X-Received: by 10.98.16.210 with SMTP id 79mr31951028pfq.69.1456957012654; Wed, 02 Mar 2016 14:16:52 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id n79si60741030pfj.101.2016.03.02.14.16.52 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 02 Mar 2016 14:16:52 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-return-67770-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libc-alpha-return-67770-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-67770-patch=linaro.org@sourceware.org; dkim=pass header.i=@sourceware.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:to:references:from:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; q=dns; s=default; b=G4A4Ek5m0uzqbh3s yip4+I4adEgI4uBYAgoIJdXoF4AE1PVOFDMqfzhj6If4Sa3gTTSKJ6+F6nk/J55z f4IWOev2CzmgJe04vyTsbbkp4chTE5REHCGVBhXrwoFlYBzZOgOE3qV6MM1qRZIv 1wOSjPAjOFHY3VeWTa5bVuP7ezg= 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:subject:to:references:from:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; s=default; bh=OndHt5kbOxf/2pEbxjwlkS Ec9PQ=; b=Hvk6AU26It6UiuEla0EGGjt2sqabrq8blXs5xq4MvO825hO1BmctDa s2MQq3PSM8i+ZmO4VbRHrkSxADvBkdpOT0tdGaX4XaCM/rSmp4SAPu88vnH74XNt 6o/4cUgIqPt6kWPHL/WjD9jtPoLpfjjAgXAE3rvbbnb/d2abG20VU= Received: (qmail 104369 invoked by alias); 2 Mar 2016 22:16:42 -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 104351 invoked by uid 89); 2 Mar 2016 22:16:42 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=02032016, Extra, UD:libc.so, libcso X-HELO: mail-yk0-f180.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=WXYoBqUmbbEtGDM4XPc/zKbqb2xIZwals/yG/bw4R/U=; b=k3fHS3G/4itTqBRbBCmNqj+BD9E3ec7ZvlwVJo084r60RM9ZVzJyGyvd4Oymehq7c4 qaoJDUyOBZK5SqHwcYWHV3PUWn1sezb4CrgcFMbLgIXfRL0FgpjxTsaZMcaXMt5e+dby ekhnyWGQlEEshwJIqA/BqsWVhtIPCyZgowsy+dLawvBk5WLMt3gEMhIwBbMyij+5Jovq DbtHbzQLyoXQW5giqqYlqm2AhMf/+UyHtu8NFMGpCwNCTjre1E+ZXgP/ZpKPgKn0vv08 Qd+/bS7NfnDb8nbABghubU8kaWsVeEfu75vtM17vcvG2TS1Fdv1zD8SXObG+OlQ118tV WqBA== X-Gm-Message-State: AD7BkJKiEAvTwG/4X9BYXoT8RTrbw/UYhXEjfHunPJeujoEqsqzMBHVCTQiYRJ/3OEgA+4oC X-Received: by 10.37.79.66 with SMTP id d63mr15686841ybb.56.1456956999079; Wed, 02 Mar 2016 14:16:39 -0800 (PST) Subject: Re: --enable-stack-protector for glibc, v4, now with arm To: libc-alpha@sourceware.org References: <1456677695-29778-1-git-send-email-nix@esperi.org.uk> <87twko68ew.fsf@esperi.org.uk> From: Adhemerval Zanella Message-ID: <56D76644.8050906@linaro.org> Date: Wed, 2 Mar 2016 19:16:36 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <87twko68ew.fsf@esperi.org.uk> On 02-03-2016 15:28, Nix wrote: > On 28 Feb 2016, nix@esperi.org.uk spake thusly: > >> This is version 4 of the stack-protected glibc patch, incorporating all review >> comments to date (unless I missed some), and adding a degree of arm support >> (i.e. "I know nothing about the platform but the tests passed"). > > So... other than the changelog, is there anything else I need to do to > get review of the trickier parts of this? I've exhausted all the > platforms I have access to and fixed all regressions on such platforms, > but am happy to test/fix on more if people give me access to them. > I did not review the patch themselves in detail, but I gave them a try on aarch64 and ppc64le using the default --enable-stack-protector. I saw only one regression, which I also saw on i686 and x86_64 and (and makes me question either why you did not see it or if you just overlook it): FAIL: elf/check-localplt $ cat elf/check-localplt.out Extra PLT reference: libc.so: __stack_chk_fail Since there is no information indicating __stack_chk_fail is local, the linker creates internal PLT calls. We can solve it by the same strategy we used on memcpy/memmove compiler call generation by using asm symbol hack directive: This seems to fix x86_64 and powerpc64le (also if we decide to add this patch please add a comments explaining the issue). And I also agree with Szabolcs Nagy about patch 15/16, we need to understand better what is happening on the mentioned assembly routines before adding hacks. Have you tried remove the assembly implementations for i386 and let is use the default C implementation to check if it is something related to the asm routines themselves? diff --git a/sysdeps/generic/symbol-hacks.h b/sysdeps/generic/symbol-hacks.h index ce576c9..12829cc 100644 --- a/sysdeps/generic/symbol-hacks.h +++ b/sysdeps/generic/symbol-hacks.h @@ -5,3 +5,7 @@ asm ("memmove = __GI_memmove"); asm ("memset = __GI_memset"); asm ("memcpy = __GI_memcpy"); #endif + +#if !defined __ASSEMBLER__ && IS_IN (libc) +asm ("__stack_chk_fail = __stack_chk_fail_local"); +#endif