From patchwork Thu Sep 21 20:26:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Wilson X-Patchwork-Id: 113932 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp2448145qgf; Thu, 21 Sep 2017 13:27:42 -0700 (PDT) X-Received: by 10.98.86.135 with SMTP id h7mr6817442pfj.216.1506025661940; Thu, 21 Sep 2017 13:27:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506025661; cv=none; d=google.com; s=arc-20160816; b=wC6F7kK16H5fk7lFTDGJOVrP5gE+Sa1bFqeIO1m/jba13w7Qlj13W8Lm4Z+fxJ3vAC wxDnP5VndlPyLpCeId7XTpnJ+8Sr8nBXF0olUBKI73kdlDsznFQVU2svfxs35C8mMzWs UhfnBKg7O1/0jW4wl2CYmVBI9123IqWTDkY5HOS3GvSsgO3BpYJhhbTLe8T2h03lGgKI aVTtsu0isF8Rfs9nSpLHazFw7GG4PYQAdsvFZqAoOI81dcXf5DfqsvKifb90L+xZaFhg RUrkQ6khtfCs4aO2PNpIgZpw1hLzjVszkmbqYQJDSSkuS6cy/8e+TklokM8GOXA3+WM0 j/Pw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from:delivered-to:sender:list-help :list-post:list-archive:list-subscribe:list-unsubscribe:list-id :precedence:mailing-list:dkim-signature:domainkey-signature :arc-authentication-results; bh=2G+z4vGO5HjB8nbkMnRKNRVfZ05KxFUbR6xT2cj1uRg=; b=lT1nzH0PxN/ENCKegopZGDGyilZYQFYuaLgDOyGHvrcSXdytdd08Xh8oxBDHrFo3SC oWkKFLISuKs7cSDJTPS9gy4rbvrxuS3Mt9xI6a7dy5I8CangDVLjt1o2ortQ9Ody+7Nm 49nO4/AIknRtx3LCjyjHbWtKCeJMYmoSeusAgxvJgCLYNLPuqZNFcb5oEDpSpfPdOb+I aefK/IbpIOisDncpgKfH/hoLI1adIHP9++rt9bLDF+7g9GVih/mBMiLI7xHiBsawb10U 80/08G+fHoDqSb4a7mym83A85sCwCd/eCCgdqRIldX65eqMSJ0bNATSxPOJNk0OA5aZ6 PeLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=jDYpCFpy; spf=pass (google.com: domain of binutils-return-98487-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=binutils-return-98487-patch=linaro.org@sourceware.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id a9si1518412pgd.800.2017.09.21.13.27.41 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Sep 2017 13:27:41 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-return-98487-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=jDYpCFpy; spf=pass (google.com: domain of binutils-return-98487-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=binutils-return-98487-patch=linaro.org@sourceware.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.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:cc:subject:date:message-id; q=dns; s= default; b=EuWtl9C7+YTn7RIaVxhw+kWDIrBRMtWYZIzAOT6vifGy8nIQlIRL0 ya1ljGC3QMZkbx5jIZd36L8E4J1sdR8W0bX5qX541QZ9EY7wcYLuV3srx/RwGg0O viB465hs3dRdwz0vLkAXYuCvW0Kb1v6TX27FyUOBNrt5etEHrubsFw= 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:cc:subject:date:message-id; s=default; bh=TaErVVAOLGi6+j6A35hhGs8qWnI=; b=jDYpCFpyL9f+iZL9oiL+0tkuYByX ItszHKVujl/iGATwDcMy6TU/UdQ7g9ZPt8OWqgolaYWt31MnCZxZmoUrbWcfwp/y jxpR8ykCTM4VD7swgzVrkHba1jHjBLo1kxSV9lRtiDB6CCdhfdqKURjvyF05y+jh waSEmwcsw54GcMg= Received: (qmail 40878 invoked by alias); 21 Sep 2017 20:27:30 -0000 Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org Delivered-To: mailing list binutils@sourceware.org Received: (qmail 40868 invoked by uid 89); 21 Sep 2017 20:27:29 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:2394 X-HELO: mail-io0-f182.google.com Received: from mail-io0-f182.google.com (HELO mail-io0-f182.google.com) (209.85.223.182) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 21 Sep 2017 20:27:28 +0000 Received: by mail-io0-f182.google.com with SMTP id g32so13635252ioj.2 for ; Thu, 21 Sep 2017 13:27:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=2G+z4vGO5HjB8nbkMnRKNRVfZ05KxFUbR6xT2cj1uRg=; b=VkZsaGWuD0M1gjXX2J2UyDF/V/wkJQ5ws5X6H0brifODeLSsOSOwXB3f4ntjilT9Fg OVNSloTFp6ODN6CJRlomufinaa9+QyXVqUd/95cmShNsgGFp6e14kivGVAW4rd3Qc7Ri y8f1aWWxgLviu2AtSgg/yzqYYM+AQrYwOZeOGnY8tdymsBq4x2/vxi+QJ3A6QN2p3zat JamWWVNUAMp6Vj42aThqSBaHh+nCdOGhNGrHJU25CtDrWrDON3GQGLhuD25Nsm4puYZt EDmOuHuRI2Bz06U3vK6ue0AXtIAZ5FFkZqp7chxG0fRz0/g1NAK4UpZgJNf5YYsjD9Fw V4KA== X-Gm-Message-State: AHPjjUh25e/3TT+oYdSQZmhstEAGG8hhLUFNdnUvFq8BLrf6KqPdECqG NAauoqkJMMIzEO62mH+GOhNcviVnAH0= X-Google-Smtp-Source: AOwi7QCodVsXgf/aXuxg4bzj/2aHBRuggLxehnNQC6LR9seSkYeCvJRF7OmH8PLuGG+lixN542AjEg== X-Received: by 10.202.226.4 with SMTP id z4mr3393655oig.110.1506025646402; Thu, 21 Sep 2017 13:27:26 -0700 (PDT) Received: from weathertop.attlocal.net ([2602:306:80a3:c890:201:73ff:fe02:1650]) by smtp.gmail.com with ESMTPSA id c71sm3676351oih.34.2017.09.21.13.27.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 21 Sep 2017 13:27:25 -0700 (PDT) From: Jim Wilson To: binutils@sourceware.org Cc: Jim Wilson Subject: [PATCH, GOLD, AArch64] default stack not executable Date: Thu, 21 Sep 2017 13:26:15 -0700 Message-Id: <1506025575-1559-1-git-send-email-jim.wilson@linaro.org> For aarch64, ld.bfd makes the stack not executable when a GNU-stack note is missing. Note that elf_backend_default_execstack is 0 in bfd/elfnn-aarch64.c. However, ld.gold makes the stack executable when a GNU-stack note is missing. Note that is_default_stack_executable is true in gold/aarch64.cc. This appears to be a bug in gold. It also looks like 64-bit ppc gets this wrong also, though I have not tested that. The following patch fixes this for aarch64 by changing gold aarch64 to make is_default_stack_executable false. This was tested with a make check, and there were no regressions. It was also verified against a testcase using a .s file with a missing GNU-stack note. gold/ * aarch64.cc (Target_aarch64::aarch64_info): Set is_default_stack_executable to false. --- gold/aarch64.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) -- 2.7.4 diff --git a/gold/aarch64.cc b/gold/aarch64.cc index a72e2c3..4c6e920 100644 --- a/gold/aarch64.cc +++ b/gold/aarch64.cc @@ -3523,7 +3523,7 @@ const Target::Target_info Target_aarch64<64, false>::aarch64_info = false, // has_make_symbol false, // has_resolve false, // has_code_fill - true, // is_default_stack_executable + false, // is_default_stack_executable true, // can_icf_inline_merge_sections '\0', // wrap_char "/lib/ld.so.1", // program interpreter @@ -3551,7 +3551,7 @@ const Target::Target_info Target_aarch64<32, false>::aarch64_info = false, // has_make_symbol false, // has_resolve false, // has_code_fill - true, // is_default_stack_executable + false, // is_default_stack_executable false, // can_icf_inline_merge_sections '\0', // wrap_char "/lib/ld.so.1", // program interpreter @@ -3579,7 +3579,7 @@ const Target::Target_info Target_aarch64<64, true>::aarch64_info = false, // has_make_symbol false, // has_resolve false, // has_code_fill - true, // is_default_stack_executable + false, // is_default_stack_executable true, // can_icf_inline_merge_sections '\0', // wrap_char "/lib/ld.so.1", // program interpreter @@ -3607,7 +3607,7 @@ const Target::Target_info Target_aarch64<32, true>::aarch64_info = false, // has_make_symbol false, // has_resolve false, // has_code_fill - true, // is_default_stack_executable + false, // is_default_stack_executable false, // can_icf_inline_merge_sections '\0', // wrap_char "/lib/ld.so.1", // program interpreter