Message ID | 61ed62f8934fab4c73c2b6d871a5363eeb2f3c91.1593612309.git.szabolcs.nagy@arm.com |
---|---|
State | New |
Headers | show
Return-Path: <libc-alpha-bounces@sourceware.org> X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=libc-alpha-bounces@sourceware.org; receiver=<UNKNOWN>) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-armh-onmicrosoft-com header.b=Uu01FXhs; dkim=pass (1024-bit key) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-armh-onmicrosoft-com header.b=Uu01FXhs; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49xkSD4M4dz9sTT for <incoming@patchwork.ozlabs.org>; Thu, 2 Jul 2020 00:41:16 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9C88938618B6; Wed, 1 Jul 2020 14:41:14 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60080.outbound.protection.outlook.com [40.107.6.80]) by sourceware.org (Postfix) with ESMTPS id 1DBEC3861896 for <libc-alpha@sourceware.org>; Wed, 1 Jul 2020 14:41:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 1DBEC3861896 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=nmnW/mJtjGYoqvhu9ubaKoqfEwsI6vQsqRgYcIwDU/w=; b=Uu01FXhs5t9jwuSG28sli+wX/b96cFBkGZCyZMxI+43ZreWKwULv70EvYKtT2nucAPEeL4rwlY9y02cdSCrinxJ2rWtL9YbQF4Lh7mBVAOsKl9BtOh5+kWlxdPx+cmgkSxaAOVtyGfiA2VrPweO9JqNisKsgTpKN4DYELm95GLw= Received: from DB6PR0202CA0039.eurprd02.prod.outlook.com (2603:10a6:4:a5::25) by AM0PR08MB5012.eurprd08.prod.outlook.com (2603:10a6:208:15b::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3131.24; Wed, 1 Jul 2020 14:41:10 +0000 Received: from DB5EUR03FT044.eop-EUR03.prod.protection.outlook.com (2603:10a6:4:a5:cafe::87) by DB6PR0202CA0039.outlook.office365.com (2603:10a6:4:a5::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.22 via Frontend Transport; Wed, 1 Jul 2020 14:41:10 +0000 X-MS-Exchange-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 DB5EUR03FT044.mail.protection.outlook.com (10.152.21.167) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3131.20 via Frontend Transport; Wed, 1 Jul 2020 14:41:10 +0000 Received: ("Tessian outbound 4e683f4039d5:v62"); Wed, 01 Jul 2020 14:41:09 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 48afbd4f4caf6c8a X-CR-MTA-TID: 64aa7808 Received: from cf7fb48b47ab.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 4DFCE2DC-7777-4F50-A40A-4F9969D083B8.1; Wed, 01 Jul 2020 14:41:04 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id cf7fb48b47ab.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 01 Jul 2020 14:41:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Jq/FfWNu8qIPKuFmcKH/MNOvnhbysH58UzyyH+UCAacyAUdqSmwDZHTi03me9Hov2sBbILBfclvb3P6ko7HEEJCs8dzsLeas/P5DtQ6/Oc0xS4qdrQfCq55eSq+77yZLK0Bl32dRXotKueSxKWtcxcQVSwH94FyNgBZz4KBGvMf8INYNvA5jx44C5EpEk9IoxCCS/IFXkoz/cYXHPc8pe3bS6wXpzoI5VF8/c3l9TUAgcyVGtWNr74IDmc+mHj7mWMObGZgbxaFVGIXh+Sl6a/jPHpxwUEpXzAcmDMimn92Wt2m5educIW2xA6LkC4Q5iL1+KUE8Rk95bz0fLHq5eg== 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=nmnW/mJtjGYoqvhu9ubaKoqfEwsI6vQsqRgYcIwDU/w=; b=NB3yJ5OSkBgOpgHfAYZ0EIqyaOKCf2FsTmsSyfTLJlnxaYd9szw1lE3QcU1NnEXo5Iew9lQduriYlRIvHwg60l5FUmdBX1XqPbH4nkugTswDtYjiudGQUDmS0+hK1wU1eYcUsGrQeXb0SiXCNziMv/SNfSZ+C4mokx1bXMZtEVpNRnsWkgZjFPR887bCNhXY786Y9KHao5HCGr4egpmUY4G5kgEEB5D5zxXcMImRe0IXOjzkMMHS6QdWkZS8h5NKzuy4OTMynpn/KQA+XZLgHfCkDfSk68xUugVhITRr6q5uV7NYL4MPScgdxNl93JMHGONlkGcETW95ThArXJtkVQ== 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=nmnW/mJtjGYoqvhu9ubaKoqfEwsI6vQsqRgYcIwDU/w=; b=Uu01FXhs5t9jwuSG28sli+wX/b96cFBkGZCyZMxI+43ZreWKwULv70EvYKtT2nucAPEeL4rwlY9y02cdSCrinxJ2rWtL9YbQF4Lh7mBVAOsKl9BtOh5+kWlxdPx+cmgkSxaAOVtyGfiA2VrPweO9JqNisKsgTpKN4DYELm95GLw= 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 AM6PR08MB3879.eurprd08.prod.outlook.com (2603:10a6:20b:8c::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3131.24; Wed, 1 Jul 2020 14:41:03 +0000 Received: from AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::2404:de9f:78c0:313c]) by AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::2404:de9f:78c0:313c%6]) with mapi id 15.20.3131.033; Wed, 1 Jul 2020 14:41:03 +0000 From: Szabolcs Nagy <szabolcs.nagy@arm.com> To: libc-alpha@sourceware.org Subject: [PATCH v6 13/14] aarch64: redefine RETURN_ADDRESS to strip PAC Date: Wed, 1 Jul 2020 15:40:56 +0100 Message-Id: <61ed62f8934fab4c73c2b6d871a5363eeb2f3c91.1593612309.git.szabolcs.nagy@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <cover.1593612309.git.szabolcs.nagy@arm.com> References: <cover.1593612309.git.szabolcs.nagy@arm.com> Content-Type: text/plain X-ClientProxiedBy: LO2P123CA0020.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:a6::32) 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.53) by LO2P123CA0020.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:a6::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.23 via Frontend Transport; Wed, 1 Jul 2020 14:41:02 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [217.140.106.53] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: f3e77c06-0a6d-4c05-2789-08d81dcccbe0 X-MS-TrafficTypeDiagnostic: AM6PR08MB3879:|AM0PR08MB5012: X-Microsoft-Antispam-PRVS: <AM0PR08MB50120F36355309ADDA1CCBA4ED6C0@AM0PR08MB5012.eurprd08.prod.outlook.com> x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:7219;OLM:7219; X-Forefront-PRVS: 04519BA941 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: Bfi/1lX7IrhGr+PefVHSip/glzVSD917a6miLFuN2Jhy+4e5hA2CVZbBU7yIWumKAA16yJ7UzNiTQgjCwdDLQ7+vCHYr8v56VbMmV513nVOpwwi9JznhTedTNsA0VGncQiZA5IIBXPSdcWe7UOT44/wHcZyJk/TJv8zLJhZEeTs4+1SqfkfFki8qyaG9iHkUiOBNivjU72SL0z9l+xyRIoFfG72xRvwnDYYAwoJ8t7k7fem36gAWsdacfOmPhQ69rcKP8dx05Bm8f8vKyKaebEQl+e2f2LkgkwsUk3Y0XyHIGRo+Ug9HavkrN41hr3sI3Jyyrst8GVSwQFGWjCDm7yvqd3yUNIvhhLpGOoobOfN3eCW+ZKcCOJg6Z2fNbtVy71WD5OyDb0a/SzoIoCeIHFg3uS848gKUVBJlPLXasqs= 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)(366004)(136003)(346002)(376002)(396003)(186003)(2906002)(52116002)(478600001)(36756003)(956004)(2616005)(6916009)(6512007)(66946007)(66476007)(44832011)(6666004)(66556008)(6486002)(69590400007)(83380400001)(5660300002)(26005)(6506007)(16526019)(86362001)(8936002)(316002)(8676002)(136400200001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: yU7exD/Bj6bcu3BeJtOVpvrlm/C91ASiw6OYDPrJTPZw5ADSaJXna94ReSa0ZLVX+kNXHU95Le3qhRJ5fs2iOdLYHbTIPIX1Qrscq1XSuDLCnEOXF+5spu5GdrBzjAHrauk0/1CwQYUxd7Oxe1cyazzJdBMNQTXeqx0y4CJdOypYZfps1q+Zgf7C0GKm9CEPDOJJMbxpLizGv49dfCvF4g0PoMjYCp2AfOvPNhlani0jaeDnH5AD8MOUEu2ZUu31Tp4N8/Xzsf85+h1zSVj7L3H04SIyHi8jemNA0ft3PMkcguFx2D2t/3ERZ3OG8ueT42x8S2eKOgZH9HyEBCT5Pfhj/eTdqcXJaqR+2bVA6+28aTjBKgxZ2viBfO/01EMH/N7A3teCs9fRSZ7kI9QzwY4HdTIoPr7C1uvULpvegegG95mUrCjMC2JLHM5CnVtW0e4b+J0d5mq8MZxLoHsM2XkDd9lRMcMFJEdmauezG0U= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3879 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: DB5EUR03FT044.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)(396003)(39860400002)(346002)(136003)(376002)(46966005)(2906002)(16526019)(69590400007)(44832011)(8936002)(186003)(8676002)(36756003)(83380400001)(5660300002)(478600001)(6506007)(316002)(6486002)(356005)(6666004)(81166007)(2616005)(70206006)(26005)(70586007)(956004)(6916009)(86362001)(47076004)(82740400003)(82310400002)(336012)(6512007)(136400200001); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: a6711e9b-e4a3-4de1-5a5b-08d81dccc761 X-Forefront-PRVS: 04519BA941 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZqrVO0y5DT3bo7nrEc6PYJnsFKJ3a8AjQ1tgtfL1Ev6aNTu81H1gUoIozEjkaqBLhjg9sjeh+ECGukeS0A8REH2J0XzaBExMHttv3XUu2jHyA7geDL2qUzc2lfKZKmdB243JWVOlQzyqMhxDEMFY+qwoooSqCRjVH3OKpnAiz7rE0xKzIYSlxf5s8Y83loWlcFm0Lb2yzT5ltplbJflq7MWV9+Z6KHrWq8g/vSWYn7JyqsyzLDYONnwTXmv5Z4vHde9pG6aX2/dwJi0JgiZqBki3acAToMiOx1aUoj6Uj60qJf1es7BV0vCSkDg0gfugXUMCkSgQM0hvLo9g+Nd+odLYdpOuc8GCeRXbU5V+06sf/SxjgMd1negqvVQmRkIqlDNREwPp+Sj3jV7jV6CMpg1ZtEcXVHMcwu9X2BhoU74vz3asbpsyEGEwHlQppCVmS+A1VIGaXJMZwkZsng4HaA== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jul 2020 14:41:10.3684 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f3e77c06-0a6d-4c05-2789-08d81dcccbe0 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: DB5EUR03FT044.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB5012 X-Spam-Status: No, score=-16.3 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 <libc-alpha.sourceware.org> List-Unsubscribe: <http://sourceware.org/mailman/options/libc-alpha>, <mailto:libc-alpha-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/libc-alpha/> List-Post: <mailto:libc-alpha@sourceware.org> List-Help: <mailto:libc-alpha-request@sourceware.org?subject=help> List-Subscribe: <http://sourceware.org/mailman/listinfo/libc-alpha>, <mailto:libc-alpha-request@sourceware.org?subject=subscribe> Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" <libc-alpha-bounces@sourceware.org> |
Series |
aarch64: branch protection support
|
expand
|
On 01/07/2020 11:40, Szabolcs Nagy wrote: > RETURN_ADDRESS is used at several places in glibc to mean a valid > code address of the call site, but with pac-ret it may contain a > pointer authentication code (PAC), so its definition is adjusted. > > This is gcc PR target/94891: __builtin_return_address should not > expose signed pointers to user code where it can cause ABI issues. > In glibc RETURN_ADDRESS is only changed if it is built with pac-ret. > There is no detection for the specific gcc issue because it is > hard to test and the additional xpac does not cause problems. LGTM, thanks. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> > --- > sysdeps/aarch64/sysdep.h | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/sysdeps/aarch64/sysdep.h b/sysdeps/aarch64/sysdep.h > index 2879aeaa5c..48fa8e9e90 100644 > --- a/sysdeps/aarch64/sysdep.h > +++ b/sysdeps/aarch64/sysdep.h > @@ -44,6 +44,13 @@ strip_pac (void *p) > asm ("hint 7 // xpaclri" : "+r"(ra)); > return ra; > } > + > +/* This is needed when glibc is built with -mbranch-protection=pac-ret > + with a gcc that is affected by PR target/94891. */ > +# if HAVE_AARCH64_PAC_RET > +# undef RETURN_ADDRESS > +# define RETURN_ADDRESS(n) strip_pac (__builtin_return_address (n)) > +# endif > #endif > > #ifdef __ASSEMBLER__ > Ok.
diff --git a/sysdeps/aarch64/sysdep.h b/sysdeps/aarch64/sysdep.h index 2879aeaa5c..48fa8e9e90 100644 --- a/sysdeps/aarch64/sysdep.h +++ b/sysdeps/aarch64/sysdep.h @@ -44,6 +44,13 @@ strip_pac (void *p) asm ("hint 7 // xpaclri" : "+r"(ra)); return ra; } + +/* This is needed when glibc is built with -mbranch-protection=pac-ret + with a gcc that is affected by PR target/94891. */ +# if HAVE_AARCH64_PAC_RET +# undef RETURN_ADDRESS +# define RETURN_ADDRESS(n) strip_pac (__builtin_return_address (n)) +# endif #endif #ifdef __ASSEMBLER__