From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00056.outbound.protection.outlook.com [40.107.0.56]) by sourceware.org (Postfix) with ESMTPS id AA29E3857C64 for ; Fri, 24 Jul 2020 16:02:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org AA29E3857C64 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=Matthew.Malcomson@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=CJYBMWmWOX3AlrMAHk8uZMKeMNc3BE8JR8mGJoYjPrc=; b=khiBaYzQ0ZfIgMuvSVYe588K1uq6jigU8pWvZPDqSSoEe6mS1+OJvW/yJ0zW/5gTIKkIRL2UXAamW9Yk6EFDQT2sBmIDb5w8U3DhqfYXdwyrc+vAH7ZQwXpQK4PF9x8AZHUu6CUuL7TkdoLLYj2sF3qyjCgA2eAcxyMNVhQDZg4= Received: from AM6P193CA0046.EURP193.PROD.OUTLOOK.COM (2603:10a6:209:8e::23) by DB6PR0802MB2440.eurprd08.prod.outlook.com (2603:10a6:4:a1::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.24; Fri, 24 Jul 2020 16:02:42 +0000 Received: from VE1EUR03FT038.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:8e:cafe::91) by AM6P193CA0046.outlook.office365.com (2603:10a6:209:8e::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.21 via Frontend Transport; Fri, 24 Jul 2020 16:02:42 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; gcc.gnu.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;gcc.gnu.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 VE1EUR03FT038.mail.protection.outlook.com (10.152.19.112) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.10 via Frontend Transport; Fri, 24 Jul 2020 16:02:42 +0000 Received: ("Tessian outbound c4059ed8d7bf:v62"); Fri, 24 Jul 2020 16:02:42 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 3294544bce09e9d0 X-CR-MTA-TID: 64aa7808 Received: from 380c1191a83b.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id F05A3F1A-5E4A-4985-964A-3577C143832D.1; Fri, 24 Jul 2020 16:02:37 +0000 Received: from EUR05-AM6-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 380c1191a83b.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 24 Jul 2020 16:02:37 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KtCmO7he4zGUBdBGw1PnktzbDFfLQu8sfbD+OUwmcFypMBrCv6x/cDG61N1UA1kj0v71wbsfMPeUD8rERIgPWWBozBy7245bX2QU9YnV+Ziyaemoa6ObJWCiwYQFiPA2FIFl3cKjAaolvLWq16d7pGf2P4Xp0ZqkZGZkt525LWaK76I2vY49DgdYrbsjWaxXNluvk8Smvz/930+U6H66P3+U3oEgWlaSIuLBjH9atc8ABKpHmYaQC9p04q+KOAakARYUFKLevdBVYV0mWGxMHyuoms+vWLRSgbog/k6ka1RPhhvXCicRjwfIxBED6OyEo3JdbVDWQ2pbsENtczfMrg== 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=CJYBMWmWOX3AlrMAHk8uZMKeMNc3BE8JR8mGJoYjPrc=; b=JuPiuCMyYYe+SBDEEnpZxhXzbauxh65w419+5a1lk7GjAJ8tj8zo/uaiC34RNo3NvM3bMNfwE/6JNw3bzra1muqdOO0ip5h0eoioLY9fgNseBJZ5eFCQ/B44wU79KDTLyvuF60l/jNwWXDSRLEDj0yCqwkfahWckJM3euSsI+2csAc3NXwwt5iPBBi6E5j+asYaO9X987XiVIXewNbOlDxJaOVc+l3kyza9oy2/k1Hu1TxyE9uZEhkxT0IgQ9JhlBuu/esnsExmxSheO3OibhKA8QFCNdkNc5zGR02F6OKYKu68hyI1GZsjedOAjZKhTIpFIHHETofBlIEmrPNGsXg== 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=CJYBMWmWOX3AlrMAHk8uZMKeMNc3BE8JR8mGJoYjPrc=; b=khiBaYzQ0ZfIgMuvSVYe588K1uq6jigU8pWvZPDqSSoEe6mS1+OJvW/yJ0zW/5gTIKkIRL2UXAamW9Yk6EFDQT2sBmIDb5w8U3DhqfYXdwyrc+vAH7ZQwXpQK4PF9x8AZHUu6CUuL7TkdoLLYj2sF3qyjCgA2eAcxyMNVhQDZg4= Authentication-Results-Original: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=arm.com; Received: from AM6PR08MB3157.eurprd08.prod.outlook.com (2603:10a6:209:48::24) by AM6PR08MB5255.eurprd08.prod.outlook.com (2603:10a6:20b:ef::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.26; Fri, 24 Jul 2020 16:02:34 +0000 Received: from AM6PR08MB3157.eurprd08.prod.outlook.com ([fe80::5f9:be56:311a:c1dd]) by AM6PR08MB3157.eurprd08.prod.outlook.com ([fe80::5f9:be56:311a:c1dd%3]) with mapi id 15.20.3216.024; Fri, 24 Jul 2020 16:02:33 +0000 Subject: Re: SLS Mitigation patches backported for GCC9 To: Kyrylo Tkachov , "gcc-patches@gcc.gnu.org" Cc: Richard Earnshaw , Ross Burton , Richard Sandiford References: <159534453451.25601.18119761260522884038.scripted-patch-series@arm.com> From: Matthew Malcomson Message-ID: Date: Fri, 24 Jul 2020 17:02:32 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO3P123CA0003.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:ba::8) To AM6PR08MB3157.eurprd08.prod.outlook.com (2603:10a6:209:48::24) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [10.2.78.69] (217.140.106.52) by LO3P123CA0003.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:ba::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.23 via Frontend Transport; Fri, 24 Jul 2020 16:02:33 +0000 X-Originating-IP: [217.140.106.52] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: e15c5c4b-387b-4eb1-a177-08d82feaff49 X-MS-TrafficTypeDiagnostic: AM6PR08MB5255:|DB6PR0802MB2440: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:10000;OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 5VvrSjkFiHJPg7j+c9lkvisxTf291ksgzSOzpxEXA2aed2XtfquKBZeBgyvIpehs5ioeIns2d0EGvKJkmvLUueuOnRcpCiMl2H4HRk6UeBmiqS75J3TDQca+rJiVI72HtbKqT41gF4LOwIgLZDgf2b+kGWf69p3JFoWvbvGUNpJU+wMaAGAaVzf4zk6JrthF9PXBGhhHX0byuayFngpVTFz22sneU8mV8eVbMZIva9WeAuCUrzLMrJEff5wXqkz8riQtt/MuDxiG6je8AbUcwxvtxKmzUS2S0oBLAzk+vNIO20iAqxCb9Ubfcaq2Dfuytca9koq5OssrDdcdZbaGMD43AqzEzknVS0DdN6nvPopJk+MwPR4GYBj8Aphrp+X2 X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR08MB3157.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(376002)(396003)(136003)(39860400002)(346002)(366004)(44832011)(31686004)(186003)(110136005)(53546011)(54906003)(16526019)(52116002)(83380400001)(5660300002)(956004)(2616005)(16576012)(8936002)(31696002)(66946007)(66556008)(66476007)(6486002)(26005)(36756003)(316002)(478600001)(2906002)(86362001)(8676002)(4326008)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: eQhjHW6Tb5Gfd6J28WI1AnOkTfoP1kNKIB7IZDwb+rk4fpt2GhXS6qbiUoie4D2K1IAs/iDnMW9t9rlUw3ySSPbrvctPsZEhKwM9WYkQM5CrxmrexA2cHiFVJ5IlQdbl5l5JsDbQX5al/cBh2zIbn1w+TblxLzqR8RlsAcb/Cun2BxqzglOti7ycyGpEoc2AcCNB6gSCbgLb6s6YhlJrCT2oYZN80AeTJn98l4dvRMzI4ykXmeQFERein29E3tX3izIwLOpWXMruU/Be8jgFQ7ELqSBNdAEbtDq4B3nBEynt77nfzqd0D10gBwCBZHQ4lfTym6jR5m0ngCNIBYX+JffFBNz3ZIOlTNyqHTb3fFimzOTT0Y6wjtp8IHQVVv6iSzO/hlESd2cFzztmsTT9BtZAWcDXCzRurEYCzSDTxnUw/J0zR0GQviZmowoH4QeddRxdnuohmTOxLj01ZtKkDfxyMn/0iclyWIpFiUzhV1U= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB5255 Original-Authentication-Results: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT038.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: fce47de4-8bfe-42e6-c0e1-08d82feafa01 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ce93j2Dsnrzem/7EpEPb4Q7l7CQSNz2NG42aLCqURs7wlK1xrrcSwFoYaHznDcuf4AzpVCHNJ9qpqO5UYNLOSF8pDPQzGrTBBJAufg2poTOcNg/msSgLsFvyZNOf52XoQp2oSt7hz3Wy+xnL478T8UGmgytPSZpwtWXPWo6jmfh9eioZNFa2U/dTigk1bsM8KvEFYytnsHI7kypTQmXeTaPx5OafN/YD0ammxeIQkGhdrVyCF3U0RFi9bGdGIPJWPpW2VZm1xJns5euaBmH08g7drcKuS0+QQc4ipZShxN7sBym6HDpxt76ahnZMoD9TsHQGXGL6WeDXTxNzAiGzGnmP2mSRt8Qyo28Gd7MakPoeZToDoxUE2USh42refTduqQYM8Iq0ASaQv4V6ooOjR/onhhVNc1TRsvx6Ul/rRktKZUgtyx86S8aO8YtnRFZZ 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)(396003)(346002)(39860400002)(136003)(376002)(46966005)(16576012)(26005)(86362001)(478600001)(4326008)(53546011)(356005)(316002)(336012)(82310400002)(83380400001)(16526019)(186003)(956004)(2616005)(36906005)(31696002)(44832011)(6486002)(81166007)(8676002)(36756003)(70206006)(31686004)(8936002)(70586007)(2906002)(110136005)(54906003)(5660300002)(47076004)(82740400003)(43740500002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jul 2020 16:02:42.3643 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e15c5c4b-387b-4eb1-a177-08d82feaff49 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-AuthSource: VE1EUR03FT038.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0802MB2440 X-Spam-Status: No, score=-11.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, KAM_NUMSUBJECT, 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: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Jul 2020 16:02:47 -0000 On 24/07/2020 12:01, Kyrylo Tkachov wrote: > Hi Matthew, > >> -----Original Message----- >> From: Matthew Malcomson >> Sent: 21 July 2020 16:16 >> To: gcc-patches@gcc.gnu.org >> Cc: Richard Earnshaw ; Kyrylo Tkachov >> ; Ross Burton >> Subject: SLS Mitigation patches backported for GCC9 >> >> Hello, >> >> Eventually we will want to backport the SLS patches to older branches. >> >> When the GCC10 release is unfrozen we will work on getting the same >> patches >> already posted backported to that branch. The patches already posted on >> the >> mailing list apply cleanly to the current releases/gcc-10 branch. >> >> I've heard interest in having the GCC 9 patches, so I'm posting the modified >> versions upstream sooner than otherwise. > > I'd say let's go ahead with the GCC 10 patches (assuming testing works out well on there). > For the GCC 9 patches it would be useful if you included a bit of text of how they differ from the GCC 10/11 patches. > This would speed up the technical review. > Thanks, > Kyrill > >> >> Cheers, >> Matthew >> >> Entire patch series attached to cover letter. Below were the only two "interesting" hunks that failed to apply after `patch -p1`. The differences causing these were: - in GCC-9 the `retab` instruction wasn't in the "do_return" pattern. - `simple_return` had "aarch64_use_simple_return_insn_p ()" as a condition. --- gcc/config/aarch64/aarch64.md +++ gcc/config/aarch64/aarch64.md @@ -863,18 +882,23 @@ [(return)] "" { + const char *ret = NULL; if (aarch64_return_address_signing_enabled () && TARGET_ARMV8_3 && !crtl->calls_eh_return) { if (aarch64_ra_sign_key == AARCH64_KEY_B) - return "retab"; + ret = "retab"; else - return "retaa"; + ret = "retaa"; } - return "ret"; + else + ret = "ret"; + output_asm_insn (ret, operands); + return aarch64_sls_barrier (aarch64_harden_sls_retbr_p ()); } - [(set_attr "type" "branch")] + [(set_attr "type" "branch") + (set_attr "sls_length" "retbr")] ) (define_expand "return" @@ -886,8 +910,12 @@ (define_insn "simple_return" [(simple_return)] "" - "ret" - [(set_attr "type" "branch")] + { + output_asm_insn ("ret", operands); + return aarch64_sls_barrier (aarch64_harden_sls_retbr_p ()); + } + [(set_attr "type" "branch") + (set_attr "sls_length" "retbr")] ) (define_insn "*cb1"