From patchwork Tue Mar 8 13:50:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nix X-Patchwork-Id: 63679 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp2039267lbc; Tue, 8 Mar 2016 05:53:38 -0800 (PST) X-Received: by 10.13.210.7 with SMTP id u7mr15203549ywd.100.1457445218716; Tue, 08 Mar 2016 05:53:38 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id i64si4932681pfi.132.2016.03.08.05.53.38 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Mar 2016 05:53:38 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-return-67935-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-67935-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-67935-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:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=d4j6gecwMGB/dWURDr9ctXY6g1UmalX hukehg2EYtwKWLs8tc0UyQgAQ0GNPBSuV6gjEr4PCn7hPAaii4dYQLt9wHcC4bN9 aBBfqbdpetYT7K48RgAnny1DDStoJhICsEpWxZ3Ub08nSl2HL+6/OPwukqNT30CV ENz8jFWtI6Ok= 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:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=FziCKFxLssNJkOdOxy4l3Sc7u9U=; b=vRJox hqF8aX+b1xfGJ7zfLEPvsqo+lXkGiteKcnqbYPDsD5aeB7D+t+ijW/2uLDPHXjdE dvoNOCPVXALZcXniS9Fzlytojs6Ts1lvsjZwhphNixpk93E5jTUG9shI6HE42eQ2 iCtubqyJhzpHzir+SqL+65UGG2b0YplsvfsKIM= Received: (qmail 27197 invoked by alias); 8 Mar 2016 13:53:27 -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 27180 invoked by uid 89); 8 Mar 2016 13:53:26 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=1.0 required=5.0 tests=AWL, BAYES_20, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD autolearn=no version=3.3.2 spammy=redirect, Hx-spam-relays-external:sk:mail.es, HX-HELO:sk:mail.es, H*r:sk:mail.es X-HELO: mail.esperi.org.uk From: Nix To: libc-alpha@sourceware.org Subject: [PATCH 11/18] De-PLTize __stack_chk_fail internal calls within libc.so. Date: Tue, 8 Mar 2016 13:50:57 +0000 Message-Id: <1457445064-7107-12-git-send-email-nix@esperi.org.uk> In-Reply-To: <1457445064-7107-1-git-send-email-nix@esperi.org.uk> References: <1457445064-7107-1-git-send-email-nix@esperi.org.uk> X-DCC--Metrics: spindle 1282; Body=2 Fuz1=2 Fuz2=2 From: Adhemerval Zanella We use the same assembler-macro trick we use to de-PLTize compiler-generated libcalls to memcpy and memset to redirect __stack_chk_fail to __stack_chk_fail_local. v5: New. * sysdeps/generic/symbol-hacks.h (__stack_chk_fail): Add internal alias. --- sysdeps/generic/symbol-hacks.h | 6 ++++++ 1 file changed, 6 insertions(+) -- 2.7.0.198.g6dd47b6 diff --git a/sysdeps/generic/symbol-hacks.h b/sysdeps/generic/symbol-hacks.h index ce576c9..9d3662f 100644 --- a/sysdeps/generic/symbol-hacks.h +++ b/sysdeps/generic/symbol-hacks.h @@ -5,3 +5,9 @@ asm ("memmove = __GI_memmove"); asm ("memset = __GI_memset"); asm ("memcpy = __GI_memcpy"); #endif + +/* -fstack-protector generates calls to __stack_chk_fail, which need + similar adjustments to avoid going through the PLT. */ +#if !defined __ASSEMBLER__ && IS_IN (libc) +asm ("__stack_chk_fail = __stack_chk_fail_local"); +#endif