From patchwork Tue May 12 10:14:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 38967 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DBF013959C83; Tue, 12 May 2020 10:15:16 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr150051.outbound.protection.outlook.com [40.107.15.51]) by sourceware.org (Postfix) with ESMTPS id 0F377394CC12 for ; Tue, 12 May 2020 10:15:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 0F377394CC12 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=Szabolcs.Nagy@arm.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GKQoBgg4c3SHOriWg6bR8RhDgZ/V6mC7nVSg1lU4o3Y=; b=lKPma/Pb0rWdMXW1GA9EuZ5HYWCF+iXhVIGE/kw43fOljmsnTq9ywImr08UEQeAPxbzzSUtjJDf0daztZiu+BdfkAIwaoHEO+xpbbJspSnDO7tuZrR1pHx8CeSehJgtAHlOPa6tp+oJdNMZjd+MfGzWGAJ+lgjBt33DxAoFpADQ= Received: from AM7PR04CA0010.eurprd04.prod.outlook.com (2603:10a6:20b:110::20) by VE1PR08MB5133.eurprd08.prod.outlook.com (2603:10a6:803:109::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.28; Tue, 12 May 2020 10:15:09 +0000 Received: from AM5EUR03FT027.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:110:cafe::1a) by AM7PR04CA0010.outlook.office365.com (2603:10a6:20b:110::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.29 via Frontend Transport; Tue, 12 May 2020 10:15:09 +0000 Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; sourceware.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; sourceware.org; dmarc=bestguesspass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM5EUR03FT027.mail.protection.outlook.com (10.152.16.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.27 via Frontend Transport; Tue, 12 May 2020 10:15:09 +0000 Received: ("Tessian outbound 567b75aed2b9:v54"); Tue, 12 May 2020 10:15:08 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: b3424ef3191326d8 X-CR-MTA-TID: 64aa7808 Received: from a102e96403a2.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 5C901DC2-2486-4046-94EF-1F93BB8FEC92.1; Tue, 12 May 2020 10:15:03 +0000 Received: from EUR04-DB3-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id a102e96403a2.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 12 May 2020 10:15:03 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=g3jO47LSmdfL1d9IXAkjOudE6NBhc6a0gBgaLNN7qczbcQngV/iq4LEmzwlLt4+KDVxVaw5L62JoG+F6LDEShIp3xQ0jImZ0zARXs90uWDzzzDsAPLuibco52ILEVR7SpUYa2+jODxm7gPfx0B+3T5qd/2Qjc5yZLJXri6nM/vkH+874qeLWzlq4XfDyVi72bxozuA22WafENEqa6CveNpF3qzZ5VJXYrMcyqB4wRAONVXpwqzbj7sQtWXwkqK1MnSH3tYpZhA+BnjbDx9wftZZjkcOrSYjuppYYSN/QOYLTZpf8Qeet3mirjrLhUA+hvlqb4pBcXMy3RXqOJ4bzLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GKQoBgg4c3SHOriWg6bR8RhDgZ/V6mC7nVSg1lU4o3Y=; b=NQJe1YF2U/MVxxPkut2ZrFLYmf69nBhz3K+dNtlPfNm22LxXmQTK1lwwFXaE+ZcePK5eGn4Z0C1cJDWSSeRpreo22YZ6/S4BT/Y1uPm6Z0kzLvlC8h4ivmVey5WUTiQa/q7bbFgbLJPMOPKI7Ms/S7QSAw4KGD8X4FDh8R5IixRdLHAPoz9ZM2Lm05OUqP6k15rnFG3AZC4Kb4K4NkQzbs+dV5NnyH9dHDzxPhjA/aqu2ms6L28PUVGdTjgSgr+4l3e37aHfyQkXzP1x/qmXJmBtj0nZRFeeIfH3h11y5qX1XAjLCTD6z5ZaVUzvZWDCUYuefWYhxhlvXM7No1950w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GKQoBgg4c3SHOriWg6bR8RhDgZ/V6mC7nVSg1lU4o3Y=; b=lKPma/Pb0rWdMXW1GA9EuZ5HYWCF+iXhVIGE/kw43fOljmsnTq9ywImr08UEQeAPxbzzSUtjJDf0daztZiu+BdfkAIwaoHEO+xpbbJspSnDO7tuZrR1pHx8CeSehJgtAHlOPa6tp+oJdNMZjd+MfGzWGAJ+lgjBt33DxAoFpADQ= Authentication-Results-Original: sourceware.org; dkim=none (message not signed) header.d=none;sourceware.org; dmarc=none action=none header.from=arm.com; Received: from AM6PR08MB3047.eurprd08.prod.outlook.com (2603:10a6:209:4c::23) by AM6PR08MB2982.eurprd08.prod.outlook.com (2603:10a6:209:43::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.28; Tue, 12 May 2020 10:15:01 +0000 Received: from AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::49fd:6ded:4da7:8862]) by AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::49fd:6ded:4da7:8862%7]) with mapi id 15.20.2979.033; Tue, 12 May 2020 10:15:01 +0000 From: Szabolcs Nagy To: libc-alpha@sourceware.org Subject: [PATCH v2 11/13] aarch64: configure check for pac-ret code generation Date: Tue, 12 May 2020 11:14:47 +0100 Message-Id: <167fbfd1966e2a85823a4a6e8541bab0a3d6f6e1.1589277641.git.szabolcs.nagy@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: CWLP123CA0056.GBRP123.PROD.OUTLOOK.COM (2603:10a6:401:59::20) To AM6PR08MB3047.eurprd08.prod.outlook.com (2603:10a6:209:4c::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (217.140.106.55) by CWLP123CA0056.GBRP123.PROD.OUTLOOK.COM (2603:10a6:401:59::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.27 via Frontend Transport; Tue, 12 May 2020 10:15:00 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [217.140.106.55] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: d7a19000-6ce2-40bc-6216-08d7f65d5987 X-MS-TrafficTypeDiagnostic: AM6PR08MB2982:|VE1PR08MB5133: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:3276;OLM:3276; X-Forefront-PRVS: 0401647B7F X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: gWv1WifFppB0nNzqB7KlE7cHAjFZ6Npk15Owmb62I574tOs0QK3YDjlxEmCg8Hh2QqCrz63AHi2/JtB7dzifTle5HXAaBVAO8yqDClNhopzGpUO+tVF/mbeaK58nbTc9uEdje7kax4Ztw3akTVafEv5BJvkLtvh1aP1P0zKtogopGWPoRpc8O4P7+vPedj7KuDm/VJ8iIzwLvCo9rDgCQLo6LxvkAV59o2yIQ6DrVCHxoy8myShokoenZpe7rilcuEzX6fiyl2u+o+V/raIFiEMopH6nmEaQib2BgZbwUaqy1diAXLgzyvIfDl8itZry2ZOir6gpa3RpzzTootHTvRruIuwsu/k+ZDyvpIP6ronImK6VsFJeC+rbbyxRjnta4YoKv0+I+OvHQdOELQnU3GogLRz8cdPP8ndqnoDpaDWvTCuzZ95QpXal+U5HFFQ5m7o0j7nAMxUibTD6hXySAfqF+o4Hao8HVBulu+oxQKCtVAG8FQza7QY58ZYauxd74fMqxF+WmMpNAG3ZJRJwUbmZjcTfGVMbKz0/pZKemhgr8LTmnUfzr4ik4XpCh57USRcChHsUQyab2PnkEvKehistZUYpbEZyWJA/0zrUXpM= X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR08MB3047.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(39860400002)(136003)(376002)(396003)(346002)(366004)(33430700001)(6916009)(16526019)(66556008)(66476007)(36756003)(44832011)(5660300002)(52116002)(86362001)(956004)(8676002)(66946007)(69590400007)(2906002)(6486002)(186003)(316002)(2616005)(33440700001)(6666004)(478600001)(6506007)(6512007)(8936002)(26005)(136400200001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: jgVneLZ0Spj522L5f2QL4DUMMbPNl+U9iYls8lfcbu6vo2tgZywRN726wghnKl3bZagAtqGgLVKwq+WzefdPOIGT8Y3UlaIvyhhg5RpXru2QoENCmLXXOuVxCCRqnUkTRn286XrAV13fW1r1kxfunNo73YvnBjcwAUjlaP2+aINcbrUlfphaKBnhut9P/T8nOEMYmj6IfHKIiALt0sh5jPPE6smRGxC8OmaSTOLC9fWhp+oWJdJflvW2Jz8GkKtbn33xn5F3oZvtL8BkBhE+hZNTrLfEznO1CBibot6poXgzmniOEt1dYSTmLBylYgLrEfwvw8eNRubXvGx02+ope1xCQayXWdj8SjyhK976S/AIzfld5+IoZEiZWeWAsB0LDymi9LqQo6nWbMWixfhA+3EM+nYEeQEwh3F0bHmnqWl0363diwb6B738RxKbHxj3L8xMiwneddle9/4rYtfqR+YK0X2wAeH9JGNBCoBgezs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB2982 Original-Authentication-Results: sourceware.org; dkim=none (message not signed) header.d=none; sourceware.org; dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT027.eop-EUR03.prod.protection.outlook.com X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFTY:; SFS:(4636009)(376002)(136003)(396003)(39860400002)(346002)(46966005)(33430700001)(36906005)(8936002)(2616005)(956004)(186003)(316002)(16526019)(336012)(6506007)(26005)(36756003)(44832011)(5660300002)(6666004)(8676002)(6486002)(70586007)(6916009)(69590400007)(70206006)(33440700001)(82310400002)(81166007)(6512007)(82740400003)(47076004)(478600001)(2906002)(356005)(86362001)(136400200001); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: 580e867e-2fbf-4f91-4961-08d7f65d5443 X-Forefront-PRVS: 0401647B7F X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2H78V9WvEobc5U8QRskwEwAZ3Csq5aAHFVtmj/gQZQZF5eG7+J7cUcnkt9UBZEIgCpdCVN96KfWsbjMGDjz5Y7xIFbV3nGrciWxcm1dz2CbO/BV541dvGsjMmIr9OTcKnzeroHTsH8hlleUc5UdoS6a/jdHu3rIv2w4jRjV2Xtou9Z7mqNz1qEh3SNmLMKE2SeFxGZ2xM5Wf8m/fSKEjkNHfxVn7VL4Taqyn9XOx9gVLXtASuvTs9DHFFdW7ZWJSVVZzyDNifN0KIl6E5F2YQeh7qfVuZXT/9I0fAP74FZhy/k9/okDXA4XNIgb8/JFzON60Fbwczv5HbXc5DjIgzw+2aVhKReXgDe52pi97+cA1zjzY0g6pbuBZEPqBrYb6kse/ivaHqaynS1IXh/vWImlYx2JZkm7zWtUsthJ7YyJ+23FwwZt1W4nPGVBsARkKIhXHVC/8Gsl307CHmL7vzGdaKBFCvIi+St9iDmZjAPi8OEL0+jeNlSJlRQ2Uq2IbrZWw924j3xCGQdyyvTrju60BawVtElSaPWXTTnJaD5As6r+I/I0ZGmOp+Kb3D8B4WkgzXmBsoACobcFpRnHIQioizp0AerUN7Yoa0XJCnBK0JQSi1OTGyphU4dVq7bGSdBMnV5HjPRPYRX8Y8WuXlQ== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 May 2020 10:15:09.0000 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d7a19000-6ce2-40bc-6216-08d7f65d5987 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB5133 X-Spam-Status: No, score=-19.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, MSGID_FROM_MTA_HEADER, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" Return address signing requires unwinder support, which is present in libgcc since >=gcc-7, however due to bugs the support may be broken in >confdefs.h fi + +# Check if glibc is built with return address signing, i.e. +# if -mbranch-protection=pac-ret is on. We need this because +# pac-ret relies on unwinder support so it's not safe to use +# it in assembly code unconditionally, but there is no +# feature test macro for it in gcc. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if pac-ret is enabled" >&5 +$as_echo_n "checking if pac-ret is enabled... " >&6; } +if ${libc_cv_aarch64_pac_ret+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat > conftest.c <&5 + (eval $ac_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } \ + && { ac_try='grep -q -E '\''(hint( | )+25|paciasp)'\'' conftest.s' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + (eval $ac_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } + then + libc_cv_aarch64_pac_ret=yes + fi + rm -rf conftest.* +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_aarch64_pac_ret" >&5 +$as_echo "$libc_cv_aarch64_pac_ret" >&6; } +if test $libc_cv_aarch64_pac_ret = yes; then + $as_echo "#define HAVE_AARCH64_PAC_RET 1" >>confdefs.h + +fi diff --git a/sysdeps/aarch64/configure.ac b/sysdeps/aarch64/configure.ac index 798f494740..8248ecf2ed 100644 --- a/sysdeps/aarch64/configure.ac +++ b/sysdeps/aarch64/configure.ac @@ -39,3 +39,24 @@ EOF if test $libc_cv_aarch64_bti = yes; then AC_DEFINE(HAVE_AARCH64_BTI) fi + +# Check if glibc is built with return address signing, i.e. +# if -mbranch-protection=pac-ret is on. We need this because +# pac-ret relies on unwinder support so it's not safe to use +# it in assembly code unconditionally, but there is no +# feature test macro for it in gcc. +AC_CACHE_CHECK([if pac-ret is enabled], [libc_cv_aarch64_pac_ret], [dnl + cat > conftest.c <