From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 96BD5C5519F for ; Wed, 18 Nov 2020 13:33:23 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E131E2168B for ; Wed, 18 Nov 2020 13:33:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="la3wIeSb"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.b="6jwbgNdt"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.b="6jwbgNdt" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E131E2168B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:In-Reply-To:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=MmUQMqD6Zs8CiS2LkrJaHIF+Kw8P5Uf9Jdxdjns8vc8=; b=la3wIeSbUf5RHEfX+VPtUPlu6 JaCRSN8l7Ci9j4aBoSRnqs5sQB0lF0P4QB0bxTm5Gnbk/k3fsbuwnRbZYHXo2ukjmjrtZfzUcM4zU sfwu9TZ3XjLuNQbIoLu6fu9Q21YqMPTJ4ohuddHJgk5uHbPdFjkDrFPwAbkIYcluGw+0Rb7xg/sWn vkd6bj33yPrXJQGVtDJZDV+q0HEoaQk3/OM8njEWQ5QumwN6O7IyFRCIEyGDVY5BRVetrRMFd4fxz wGXlc9gOJ6xhKdZmcLbzdbfbpxgKHI/3pBjWBH+0KY4e5nJicAhfuJASUrjdS6pJI/4NY47CAQ8Lj NogHUk9XA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kfNYi-0006Un-KY; Wed, 18 Nov 2020 13:31:40 +0000 Received: from mail-eopbgr70077.outbound.protection.outlook.com ([40.107.7.77] helo=EUR04-HE1-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kfNYf-0006UI-1b for linux-arm-kernel@lists.infradead.org; Wed, 18 Nov 2020 13:31:38 +0000 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=xTozKppS4Qz08GdI8eJZTdNkiIOPFxz3uRKU/+aLdqI=; b=6jwbgNdtogTF3T6ZNCbbjlz7TU8iH9OW3TMjqFOG0OQ0qisLpJ61zfr+cPtd60fX7ARKroDo7RnM5yX5QMe/GUB46BMevi0EAIbvmnXl8ZAHoWNdnHqD1bpDhr0u4SM48uHtCsKN823DwaKygR+fANPAU1AfaFVYOLyFrKn54mo= Received: from AM6PR01CA0054.eurprd01.prod.exchangelabs.com (2603:10a6:20b:e0::31) by PA4PR08MB5901.eurprd08.prod.outlook.com (2603:10a6:102:ed::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3589.21; Wed, 18 Nov 2020 13:31:32 +0000 Received: from AM5EUR03FT056.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:e0:cafe::c7) by AM6PR01CA0054.outlook.office365.com (2603:10a6:20b:e0::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3564.28 via Frontend Transport; Wed, 18 Nov 2020 13:31:31 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; lists.infradead.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;lists.infradead.org; dmarc=pass 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 AM5EUR03FT056.mail.protection.outlook.com (10.152.17.224) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3589.20 via Frontend Transport; Wed, 18 Nov 2020 13:31:31 +0000 Received: ("Tessian outbound 13ed5f5344c0:v71"); Wed, 18 Nov 2020 13:31:31 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 9b4b680dc419c113 X-CR-MTA-TID: 64aa7808 Received: from 5afbe8852c7d.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id BCE70D72-7ECC-4E56-A702-193FEE6B04AB.1; Wed, 18 Nov 2020 13:31:25 +0000 Received: from FRA01-MR2-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 5afbe8852c7d.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 18 Nov 2020 13:31:25 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=as11YVkbv/W+xprvFSZWHtSUuxPc5NieyBSl2SFgRmbpszWyhzrWVA/4nJ6xS8kd7+OuQq9W7roNk9gUqBLXdOE76kOm431om3wXtKKpQNvMgcgttRu/LB55GqwGIZ9GNZaGn/OZSwpVTI7DBHN1SW9r0EL3FykfdYXVu/BGnB9GEnYLrqYYNcyk0EYNPoas0iKPEns3TxFupGTyd79NfM1wRU0Fpkr8cv5GkO3hGARnbaI83F+g4YHhuMyc8mCl16Eb85KelmgDZBqxhrW22kOCVvUfSe0HJ1nT+mQEgMc2vyQufk7i9yB6ioRJYjnl9+80FBro/PNblaYuuX67VA== 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=xTozKppS4Qz08GdI8eJZTdNkiIOPFxz3uRKU/+aLdqI=; b=J4f+E8lP2O4Sx/a1wgmchF7y34pLUhQkPuInyYTrpR1PTf99fRy30J756XwbDHYlyOOutOmCbolfkfedJtDiPqDoSgHCtPKXI4XmunGdeh8Y5ZnY4sCNjrXXWktCsRLTFqa677rgbu9CDj3Js+I4cOxHn3AVmLWKoK8U2CfJMmY7hOtLebffyMgAZGFt/DFQLCJGREIoOr60bfNJ1yBh53bG8q0CVZzeereBgRePyiWpc4LVLt44cSJD9Feb7YYbjWeXH1M8m+zkAT7IDLT4XR0LumIoX2u0xLyfIHSFcKJUuXFPVl4syJCeKTfzsn4Gq3pk/MUwohENHgy3LIu4iA== 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=xTozKppS4Qz08GdI8eJZTdNkiIOPFxz3uRKU/+aLdqI=; b=6jwbgNdtogTF3T6ZNCbbjlz7TU8iH9OW3TMjqFOG0OQ0qisLpJ61zfr+cPtd60fX7ARKroDo7RnM5yX5QMe/GUB46BMevi0EAIbvmnXl8ZAHoWNdnHqD1bpDhr0u4SM48uHtCsKN823DwaKygR+fANPAU1AfaFVYOLyFrKn54mo= 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 PR3PR08MB5564.eurprd08.prod.outlook.com (2603:10a6:102:87::18) by PR2PR08MB4811.eurprd08.prod.outlook.com (2603:10a6:101:21::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3564.25; Wed, 18 Nov 2020 13:31:23 +0000 Received: from PR3PR08MB5564.eurprd08.prod.outlook.com ([fe80::ad91:8ade:4623:e17b]) by PR3PR08MB5564.eurprd08.prod.outlook.com ([fe80::ad91:8ade:4623:e17b%6]) with mapi id 15.20.3541.028; Wed, 18 Nov 2020 13:31:23 +0000 Date: Wed, 18 Nov 2020 13:31:21 +0000 From: Szabolcs Nagy To: Catalin Marinas Subject: Re: [PATCH v2] arm64: Introduce prctl(PR_PAC_{SET,GET}_ENABLED_KEYS) Message-ID: <20201118133121.GA20578@arm.com> References: <20201014055106.25164-1-pcc@google.com> <87blfv6fj3.fsf@mid.deneb.enyo.de> <20201117183911.GI15033@arm.com> Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-Originating-IP: [217.140.106.54] X-ClientProxiedBy: LO2P265CA0210.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:9e::30) To PR3PR08MB5564.eurprd08.prod.outlook.com (2603:10a6:102:87::18) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from arm.com (217.140.106.54) by LO2P265CA0210.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:9e::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3589.20 via Frontend Transport; Wed, 18 Nov 2020 13:31:23 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: ab6cc771-bf6a-4edc-9b6f-08d88bc642ef X-MS-TrafficTypeDiagnostic: PR2PR08MB4811:|PA4PR08MB5901: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:8273;OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 0WQaU+XoOFqBzDwuyb1JW0xUbvvy2mzuVcUCbNL1C6eSc9G6RcxBtax2jpUo0AIlgIY8p2Y1hAULTOUpjU2gNKkhzgg2GTTbkH924j71JJk3e5P8qVya3QutxWzZ4oSYSVc05adF4uRNjZTU47jKc3WeZR3KqLenIcnb8ha6Bgy9Z/CeQK4qtJr27puB4RdyUJpa3sA9gPhDAiEfTi47uGuHYiHH3EzYYVunB5v09OhlKVcOv35fZt3f/zBhsrFrtLOzQ54GCKycyoYZzEfloVmVroCXF1YaRogctuCXgY4l3/zJGrd6pTTI6s4Nh14Gg3L0UnXz2zcoKMdmeoK3VA== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PR3PR08MB5564.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39850400004)(396003)(346002)(136003)(366004)(376002)(8676002)(186003)(44832011)(26005)(5660300002)(37006003)(54906003)(16526019)(316002)(2906002)(8936002)(8886007)(86362001)(52116002)(55016002)(1076003)(7696005)(478600001)(33656002)(4326008)(36756003)(6862004)(2616005)(66556008)(6636002)(66476007)(53546011)(83380400001)(66946007)(956004); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: +dq9GjHBAXHTC0c7gzty23vFaatWYigRHOeMezmwDK4hGKNB6X5tyCGHip1NM+lcBozyM021ldqtwVuKCKBbmRwt2CD1QxeEFAiC/3exEEapG5S+QKDzJD01xBBa+RUqXwWCwrMhv7ZnuJ28JlzBFIGi1+owFHsjKKMdSzp+DhuFSH+Uy4QnfODLlV8/GAUXcnm8Z67VSaxd5gL7fMWXv9sjKF0FQcFPflhmPTzctaUF1V65ZxKuQfKIAtdt953J9M6QfMjg/HOjePaRyFQ3EoW4uzNil3wHwrNG8q7ZVN2pYTgKQj6FEXr7LzDfJT4Tla+9fLw6hBSzH4PPAKCxhF2o20O3kjRbhDe49WHgrXtsb+/xjFc557K7NKPCPNRjRO0qh9QgwkB0ohf4Qm0JGTzMbaTPgJtidxBGJxEtw5fyL4Kj37TvHJ232mzzkVFDkFbKOOa5UBxkBdg3IhJRI36ceCnwCUGrSVS2nhs+So7s+NtfCacaeK3iDczyXNiAQpsu7m0AZGTCSp3EE1C2sRe/NXiplYm8rxk2o8PcY6XjZhqkcapJ9+G54WZ+kpITNoiOfD/aKEmSOY2m3jYSFJepRHuVAZ7e/A5DaGtKZYoNwh0+h2UXKRiuPrA8sFS/tjuBqOjsFgyPrajcusmMhd/m+YqfgqeDG+yQixIFk72ukrACuzv6sZ1bZeaz0Fo4JAX/pQXq42rUGjJYIN7O0wXL/qv9KujDvnbh44BcXs2Zp2zst6Nnz5Ux9MF60hEgxH4y8Eyyqmzgkj8MO7I2Mw6yo4A7Z/MDUeWY4Oym2Bkqwa9caUu26oUlt1anmqbgJKOyjLZtsitMlx+f/X54B0ZOc0HaKjGlKfEFGRAFLkHdInzz0ikqLZYi1wFCsv1nL6P79CMBppAKY07i+r0mow== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR2PR08MB4811 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: AM5EUR03FT056.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 47e713dd-fb17-4bf3-bc4c-08d88bc63df0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xx5VFuumxl2T/Z539oWRMQn6HrGtA3U+qNpZK6Vw70dwnCJ0LfpE6geLdAP3eMs85S+lboopvyUTvLULT379d19FbzpdrmE9JKdniQOc6GYi3n9Y3UUztmHeJ1hcHAB7rcOAJiNORI270PVGTXHxASDVfPE9g8pmhT2s6KkvBjQo+um9xkUO1EPvlHtn4P4jtzb8AFmDzzyYM+ETeg+P1c0msHqZcAjOCdBeLhy3Raxb7iO1MwygoFzrdRViYZR4PhoAn2cx/gZlS7grg4lwpL5kHhvUkMcpt0J6XKhGbSLz7104y26AiJmSTcju9qhLf+yYyvFAStSKvhe6HephvszCD6eg8wzJDYSM3m1ePyDGikq6m4rZc3m3yLdgJY9lcQsTvjCmYi1cplCAwKeJzA== 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; SFS:(4636009)(39860400002)(136003)(396003)(376002)(346002)(46966005)(6636002)(7696005)(956004)(2616005)(44832011)(81166007)(356005)(8886007)(82740400003)(478600001)(2906002)(336012)(5660300002)(83380400001)(316002)(8936002)(37006003)(47076004)(54906003)(4326008)(70206006)(33656002)(70586007)(6862004)(26005)(86362001)(1076003)(82310400003)(36756003)(55016002)(36906005)(186003)(53546011)(16526019)(8676002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Nov 2020 13:31:31.5110 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ab6cc771-bf6a-4edc-9b6f-08d88bc642ef 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: AM5EUR03FT056.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB5901 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201118_083137_241230_AD20A206 X-CRM114-Status: GOOD ( 29.02 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: libc-alpha@sourceware.org, Will Deacon , Linux API , Kevin Brodsky , Kostya Serebryany , Florian Weimer , Linux ARM , Andrey Konovalov , Vincenzo Frascino , Peter Collingbourne , Dave Martin , Evgenii Stepanov Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The 11/18/2020 12:33, Catalin Marinas wrote: > On Tue, Nov 17, 2020 at 06:39:13PM +0000, Szabolcs Nagy wrote: > > The 11/17/2020 10:17, Peter Collingbourne via Libc-alpha wrote: > > > On Tue, Nov 17, 2020 at 9:48 AM Florian Weimer wrote: > > > > > > > > * Peter Collingbourne: > > > > > > > > > This prctl allows the user program to control which PAC keys are enabled > > > > > in a particular task. The main reason why this is useful is to enable a > > > > > userspace ABI that uses PAC to sign and authenticate function pointers > > > > > and other pointers exposed outside of the function, while still allowing > > > > > binaries conforming to the ABI to interoperate with legacy binaries that > > > > > do not sign or authenticate pointers. > > > > > > > > > > The idea is that a dynamic loader or early startup code would issue > > > > > this prctl very early after establishing that a process may load legacy > > > > > binaries, but before executing any PAC instructions. > > > > > > > > I thought that the silicon did not support this? > > I think the past discussion we had was around enabling PAC for kernel > while disabling it for user. The hardware doesn't give us separate bits, > so Peter's patch toggles them on kernel entry/return, with some overhead > given by the MSR+ISB (to be added). ah ok. i probably incorrectly thought that toggling that sys register bit is too much overhead at kernel entry so assumed we cannot have PAC off by default or set per process. (i think with the proposed prctl it's possible to disable PAC at early ld.so startup and reenable it before calling into the main exe entry code, if we ever need to disable PAC-RET.) i assume thread creation/fork inherits the setting but exec does not (this is another point that may be worth adding to the documentation). if we run into issues in userspace with PAC then a prctl that can be inherited across exec is a possible workaround (so PAC can be disabled for an entire process tree). > > > > See e.g. the documentation for SCTLR_EL1.EnIA [1] for details. There > > > are also enable bits for the other three keys. > > > > i think it was insufficiently clear in the architecture > > spec how that can be context switched. (but it probably > > changed) > > The bits that we can't toggle easily have the comment "This field is > permitted to be cached in the TLB" in the ARM ARM. Luckily, it's not the > case for EnI*. ok. thanks. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel