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 18B3AC2D0E4 for ; Tue, 17 Nov 2020 18:40:51 +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 82C702222C for ; Tue, 17 Nov 2020 18:40:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="MW+7Vorw"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.b="iR5097JI"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.b="iR5097JI" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 82C702222C 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=9Zk1MBe4iWzhHsHUqC95dE7uwgEoMMuvYGyjogTg4wE=; b=MW+7VorwJxHlpzA7KBlEPcQKZ RbZVzLhUbBedg9saDR6HpGustbmRvDoKDfpPAaNYMNzKHOgTCoeuyzYjKPT0uPD5ev4UWe9T2sJHZ sW/KoyQ9CpsEzVQlSdg/nddWLLeuSqiugYGHicmBJt8P2R7EHy+dTlz8qYCsD1WdmDsDxP3D/fhdj rg3Hj2R0k6nslpEJNzC/VMocT9ZXaXXgB4TEbmqRFXp9IcNbs4xVgf7ZkrujSayI6v/DPH7JiQOUs 3JLcZd54d0zhxpO/FDYhkcQMpUJtycj48nr/83NEBMx//UfW5o4dKaDIpGwU3rFhuFCyziHg+NDyC 9i4m0NHnA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kf5t4-0003GO-NL; Tue, 17 Nov 2020 18:39:30 +0000 Received: from mail-eopbgr150040.outbound.protection.outlook.com ([40.107.15.40] helo=EUR01-DB5-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kf5t2-0003Fa-A7 for linux-arm-kernel@lists.infradead.org; Tue, 17 Nov 2020 18:39:29 +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=3A2fpYSdelGO11dQFR901DaaLdRksdEr0XXrkqfOmu0=; b=iR5097JIfAgJSH/GXfTnyvpjC3sz4vrZzYL6ogveP0uh/JPQRL08fL+KBjrmE4/KQlxZL/lR15HvasEYCjDvkOXzbYKmTY4HUaEgw2hkOdvwSEhVXbPRkekqZ8/O8sYCfaCEgXWxSfikaooInhn3VUjcYJNlAbpJA9oPjfOPv1w= Received: from MRXP264CA0024.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:15::36) by VI1PR0802MB2430.eurprd08.prod.outlook.com (2603:10a6:800:b1::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3564.25; Tue, 17 Nov 2020 18:39:24 +0000 Received: from VE1EUR03FT041.eop-EUR03.prod.protection.outlook.com (2603:10a6:500:15::4) by MRXP264CA0024.outlook.office365.com (2603:10a6:500:15::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3589.20 via Frontend Transport; Tue, 17 Nov 2020 18:39:23 +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 VE1EUR03FT041.mail.protection.outlook.com (10.152.19.163) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3564.22 via Frontend Transport; Tue, 17 Nov 2020 18:39:23 +0000 Received: ("Tessian outbound 13ed5f5344c0:v71"); Tue, 17 Nov 2020 18:39:23 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 94b8eaf14500724d X-CR-MTA-TID: 64aa7808 Received: from 55c29a3d5c6a.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 8533749F-9FD7-47FF-BAA5-AFCA13D96A71.1; Tue, 17 Nov 2020 18:39:17 +0000 Received: from EUR02-AM5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 55c29a3d5c6a.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 17 Nov 2020 18:39:17 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SOLYXz2EsC09bXtNWC+rQMno8cGNE3/cUPEHPs2SIYbaJjFTKy1ZWer8cpy7ldkOYKPYqysJUcblgIW9i8NsGsw6M3RFcUz/kL7T1gy917k8mjXPVx/lvaayQ3XjQ/zR80EEdHukI+tCHsWs3Dt/XLjfWJxynLNHIcb9KkPQah+MtoRrGDRIN8at+AgK9IWWJkG1A+6ijKaiOl20Q3Ap0kxAZDGYAmXTSLKLjJznoiOAl6WeiHdt0EzeCtb+Pp3ZDEu7WrF37zli3inpbfvsNsTplWFKyyw/R0Gmhh+i87yMJ/LaUSh2z08fIWdoztp8WHZQybDwNs3IHeYjJ149Lg== 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=3A2fpYSdelGO11dQFR901DaaLdRksdEr0XXrkqfOmu0=; b=f+0yBmNBKYKSpeCahO+d+JJtRjQl1qB5VdUo9UNLkrdPaNMGl2NsD63c02GbFLX621H58+qp8pVlVboK/NC0f1E0t4SOyr8H2+OJLWOHZBVmDtzVkNTJ/5yPgJkac0XSX7anfBqBJHj1szMgB7VoIdKNqaZaubGxCXcCYvowpA2VGR0ckvI5OcYiRg1ewF3BMbssLcSnLxWm2oGmr+sXZZi8VB/bVTymGqNvQnqX7Zd8Zj9Duw2fKFqe1adzs7eMn54pw/4l07CzzpMEwD1WwK0mrPUGrS5SX/Q5jXWL4MWaJOewW8uI4DAq54hBzwerjMe5in/4DWJAs54Aqr8AFg== 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=3A2fpYSdelGO11dQFR901DaaLdRksdEr0XXrkqfOmu0=; b=iR5097JIfAgJSH/GXfTnyvpjC3sz4vrZzYL6ogveP0uh/JPQRL08fL+KBjrmE4/KQlxZL/lR15HvasEYCjDvkOXzbYKmTY4HUaEgw2hkOdvwSEhVXbPRkekqZ8/O8sYCfaCEgXWxSfikaooInhn3VUjcYJNlAbpJA9oPjfOPv1w= Authentication-Results-Original: google.com; dkim=none (message not signed) header.d=none;google.com; dmarc=none action=none header.from=arm.com; Received: from PR3PR08MB5564.eurprd08.prod.outlook.com (2603:10a6:102:87::18) by PA4PR08MB6077.eurprd08.prod.outlook.com (2603:10a6:102:e7::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3564.25; Tue, 17 Nov 2020 18:39:15 +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; Tue, 17 Nov 2020 18:39:15 +0000 Date: Tue, 17 Nov 2020 18:39:13 +0000 From: Szabolcs Nagy To: Peter Collingbourne Subject: Re: [PATCH v2] arm64: Introduce prctl(PR_PAC_{SET,GET}_ENABLED_KEYS) Message-ID: <20201117183911.GI15033@arm.com> References: <20201014055106.25164-1-pcc@google.com> <87blfv6fj3.fsf@mid.deneb.enyo.de> Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-Originating-IP: [217.140.106.54] X-ClientProxiedBy: LO2P265CA0404.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:f::32) 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 LO2P265CA0404.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:f::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3564.25 via Frontend Transport; Tue, 17 Nov 2020 18:39:15 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: a9f9583a-de72-4d77-4b78-08d88b281ab9 X-MS-TrafficTypeDiagnostic: PA4PR08MB6077:|VI1PR0802MB2430: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:8882;OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: UUToNJOBqjXvg8AgPfE2i5qDvS71QgQtNx9MrgW9Rq+pQclO2ffjvablf5YfgjHQtKOmytFzP3xPXr8Dy+FZNrIQdGgZsj+Eq4CFkvyw/24k/q3gWN4XJfYIR/afS+QOhGW2AQCoa3L6KjzChEMV/ALJu8vS47giTpFbDkDu/VB8ZTeJLTYIWJH5VGwUkbimXvVkzTlC2ZnViCPnAGNx4Uq0NylXpi5vJyxJ5bETyzo96pDgV4nRKur5ZFuyvlLygo780iyZhjx4k5udJdMm+asYpca/byjFnUJcUfMwa3Z5j0GUPWtwYYCoFRjB5r2TLnY8abp2AWqNjBD0GBf3eRGFECbJEDjuH2615BVoRnZqr3NlUXvUHFum+KV35PTr5/AirupmHuQf+DwITYIWLA== 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)(346002)(39860400002)(136003)(376002)(366004)(396003)(8936002)(6916009)(956004)(53546011)(2906002)(2616005)(4326008)(186003)(7696005)(66556008)(66946007)(66476007)(8676002)(83380400001)(16526019)(52116002)(54906003)(44832011)(55016002)(33656002)(1076003)(26005)(316002)(5660300002)(8886007)(36756003)(86362001)(478600001)(966005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: F8EsfmtXe9v8qgHiar4LXjkuCqNJQ8EEYTrd+KBAucqROIQ+0qSEGPDlS4jXSm8IzAwB/7XPXC8xU7kvilnBjhnOVp+OEYJsvzzkIsXUnP5ceNrY7NW/qgaNfPz0jMixMheXVYpUAxq9dHQOmb+6QVgchOVqI4x0qm/MO5Vf0QaLWAJoCaCAy6ss2rjUQQUhPuvFJVy4TOao3S8n9fNEYDaGDSQURPMs1lvodetPhCYjCTh0mEXGzbw0sv8VR0LU72KQjq6P7M3kjVPlps4yxOKxaaQTy9OfNPO/jJEeahpuNqiBShBF6vwBxcElWzRTA2U57Bye6q9pqTG67s7E//zzKHZHk/4g1bC0c64MVlQ56bFEu5DzDwOW+tyG3RQ4nSh7k5fEg6VSYN+Rs9rgJTxUZy3nxDk7F/3nh9H7PnYA4a3U/QU8TZ453rUCAlN7//wt5MkUMvJI//0+DRsVAGgegzVEwsa1BV32PHnrcFYM2+6VAVbmCrcFP+16gs3xFDvt07Iy3w2CBho2nkuLk0Gj/+KmGiOzwjE4P6ub9qCtXP7ULwpNJ4JV+HhQbebYh8xqpQeTuoq0qk/gVoSGsmKvAPQgPXBrUIZK20tCtR3z10a7P4JG/HBEJ/jQUXrzUIB14x0WblDPU3ON52+irkaQRjerpIu/U/oWHbOlWJrT1O/j9r01nuIFVev7kIOLFRy1G646kvK09ZTMa69pDEVVUw8YFYr+ki4/DBHG/K9EMyyKvbLG1H6WnAeFySRvGJszE5r4sC2Ri3KuiFH876+zkMEdIkvqolAeeh/jQpq88RimSowBLyjhyz1kDfLS70ZosatGZxOmSlpwkljfWmzZE6+l3QTZu/L4pwnnOCtT6u0YpIf1uPDP/KmxNMOxfrtbHN9ZdRGi0tpFGNhjDA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB6077 Original-Authentication-Results: google.com; dkim=none (message not signed) header.d=none;google.com; dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT041.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: cbee72ef-3992-419e-cd52-08d88b2815cf X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5Hu7PTwdLXE/yJ9tcjKKESY4puFPN1IKSAv6gQU/vTi/u4yTQacENsuzLcTQDlDdTK78Aqol6t5Xw8Ch9KY/fQM3RzVzuUrVY2AGyJfHRBn5zE2mjTNVZQToeIzvTJQ4zv56+fuZI15Fw1ZYd1Qk6gVTCizmLb11yB4/e+TWKMRU3xwtnG7amAYiydE84mV6S410dJnzhhbSQ36afV0vC8SEKnieOMQbhXhE9ilXQJOLbjOF/O/Le/mAz2cfmLJwZ9mCPL+eOISFkZCNV8TTj6A6yA1RvBCsXdLN9FRPXwXvij+DlMzPWeQSa644pUAau8MkB5ooC6KoNORYlxLrYlkzZkF6B/m8K+91mTtPQKQ5q3zGaA/mO/tY2Jh1Bt/je1nj/OWM5OqfcDWX4kR4ovMja11B1wa3tdEfKJvG71JRW6FeqTV2ELOb510SXdYNlKH9yHuj0ERs3jTv2hU12KhWwSf9HwMyk8ZynGu6sUA= 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)(346002)(396003)(136003)(376002)(46966005)(8936002)(4326008)(16526019)(6862004)(356005)(70586007)(336012)(36906005)(316002)(2616005)(53546011)(26005)(82310400003)(956004)(478600001)(7696005)(186003)(83380400001)(54906003)(966005)(86362001)(8676002)(81166007)(47076004)(82740400003)(70206006)(44832011)(33656002)(8886007)(36756003)(2906002)(55016002)(5660300002)(1076003); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2020 18:39:23.4949 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a9f9583a-de72-4d77-4b78-08d88b281ab9 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: VE1EUR03FT041.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0802MB2430 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201117_133928_428282_0EC45D5C X-CRM114-Status: GOOD ( 30.08 ) 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, Catalin Marinas , Kevin Brodsky , Andrey Konovalov , Kostya Serebryany , Florian Weimer , Linux ARM , Linux API , Vincenzo Frascino , Will Deacon , 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/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? > > 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) > If you can avoid creating function pointers before the loader has > finished recursively scanning all libraries, and the ABI uses > different keys for function pointers and return addresses, you may be > able to get away with making the decision in the loader. The idea is glibc currently only supports pac-ret, so if we enable or disable pac keys it would be for pac-ret. (i.e. we would need to do the enable/disable logic in the dynamic linker entry code before c code is executed) > that you would disable the function pointer key and leave the return > address key enabled. This would also have the advantage of at least > providing return address protection for some libraries if function > pointer protection can't be enabled. > > > There is also an issue with LD_AUDIT, where we run user-supplied code > > (which might be PAC-compatible) before loading code that is not. I > > guess we could disable PAC by default in LD_AUDIT mode (which is > > unusual, no relation to the kernel audit subsystem). > > Yes, LD_AUDIT may be difficult to deal with if it can influence which > libraries are loaded at startup. I agree that LD_AUDIT should disable > PAC by default. > > Peter > > [1] https://developer.arm.com/docs/ddi0601/d/aarch64-system-registers/sctlr_el1#EnIA_31 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel