From patchwork Wed Oct 28 14:55:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Catalin Marinas X-Patchwork-Id: 11862993 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=-12.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 0987EC4363A for ; Wed, 28 Oct 2020 19:08:50 +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 5926C24813 for ; Wed, 28 Oct 2020 19:08:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ix/Z8HF8" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5926C24813 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:Message-Id:Date:Subject:To:From: Resent-To:Resent-Message-ID:Resent-Date:Resent-From:Reply-To:Content-ID: Content-Description:Resent-Sender:Resent-Cc:In-Reply-To:References:List-Owner ; bh=tROZtrEDxZqkRnKl8ZWDkBJfmJrwizw1CqELhKbp61k=; b=ix/Z8HF88H2L0EyIC50waI0x K2J+4qw4RQRzIZln+V/Zjm1kaTzEdQUUzFWxTI6NLBN8JPndD78Yyvnpo+5C4r1HND4anIf4sXdcq xpHChLHN7MvaB4OVqKWwfTFxWkiWPUiYdZ25NozrpiOo4wNI0NHgpoYzKiI2yG++axLEgmmo0VWZ1 PlxVjwK3bZHWvo7Lwd0qoPzEjWv4TLXH8e6aZOikBM67Xacuyg03u6N73UNWRN+KDxEunnRuIQBB7 NTOZlqGSsLb1Uy+bWDFV+gWM1qO7kh2FXjki3+f7DPP/om26f/4Kk4FcUaC2j3rZi8yBjWDds8qP5 guM+oG38ig==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kXqmq-0007xs-68; Wed, 28 Oct 2020 19:07:08 +0000 Received: from foss.arm.com ([217.140.110.172]) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kXqmn-0007xR-DK for linux-arm-kernel@lists.infradead.org; Wed, 28 Oct 2020 19:07:06 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7543615EC for ; Wed, 28 Oct 2020 12:07:01 -0700 (PDT) Received: from gaia (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1C13C3F719 for ; Wed, 28 Oct 2020 12:07:01 -0700 (PDT) Resent-From: Catalin Marinas Resent-Date: Wed, 28 Oct 2020 19:06:57 +0000 Resent-Message-ID: <20201028190657.GM13345@gaia> Resent-To: linux-arm-kernel@lists.infradead.org Received: from AM8PR08MB5828.eurprd08.prod.outlook.com (2603:10a6:20b:1df::21) by VI1PR0802MB2141.eurprd08.prod.outlook.com with HTTPS; Wed, 28 Oct 2020 14:56:13 +0000 Received: from AM7PR02CA0003.eurprd02.prod.outlook.com (2603:10a6:20b:100::13) by AM8PR08MB5828.eurprd08.prod.outlook.com (2603:10a6:20b:1df::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.20; Wed, 28 Oct 2020 14:56:12 +0000 Received: from AM5EUR03FT058.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:100:cafe::31) by AM7PR02CA0003.outlook.office365.com (2603:10a6:20b:100::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.18 via Frontend Transport; Wed, 28 Oct 2020 14:56:12 +0000 Authentication-Results: spf=pass (sender IP is 198.145.29.99) smtp.mailfrom=kernel.org; arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=fail action=none header.from=arm.com;compauth=pass reason=704 Received-SPF: Pass (protection.outlook.com: domain of kernel.org designates 198.145.29.99 as permitted sender) receiver=protection.outlook.com; client-ip=198.145.29.99; helo=mail.kernel.org; Received: from 64aa7808-inbound-1.mta.getcheckrecipient.com (34.249.187.16) by AM5EUR03FT058.mail.protection.outlook.com (10.152.17.48) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3520.15 via Frontend Transport; Wed, 28 Oct 2020 14:56:12 +0000 Received: ("Tessian outbound c2dba865799e:v64"); Wed, 28 Oct 2020 14:56:12 +0000 Received: from mail.kernel.org (198.145.29.99) by VE1EUR03FT004.mail.protection.outlook.com (10.152.18.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3520.15 via Frontend Transport; Wed, 28 Oct 2020 14:55:30 +0000 X-TS-Email-ID: a51b5170-ec6a-4726-ac4d-77d76a70c76f Received: from 79a88f298d65.1 by 64aa7808-inbound-1.mta.getcheckrecipient.com id DB7D43C9-57C0-4B78-9E48-60FF73EFBE53.1; Wed, 28 Oct 2020 14:55:31 +0000 Received: from EUR01-HE1-obe.outbound.protection.outlook.com by 64aa7808-inbound-1.mta.getcheckrecipient.com with ESMTPS id 79a88f298d65.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 28 Oct 2020 14:55:31 +0000 Received: from AM5PR1001CA0013.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:206:2::26) by AM8PR08MB5841.eurprd08.prod.outlook.com (2603:10a6:20b:1db::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.18; Wed, 28 Oct 2020 14:55:30 +0000 Received: from VE1EUR03FT004.eop-EUR03.prod.protection.outlook.com (2603:10a6:206:2:cafe::21) by AM5PR1001CA0013.outlook.office365.com (2603:10a6:206:2::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.18 via Frontend Transport; Wed, 28 Oct 2020 14:55:30 +0000 Authentication-Results-Original: spf=pass (sender IP is 198.145.29.99) smtp.mailfrom=kernel.org; arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=fail action=none header.from=arm.com;compauth=pass reason=704 Received-SPF: Pass (protection.outlook.com: domain of kernel.org designates 198.145.29.99 as permitted sender) receiver=protection.outlook.com; client-ip=198.145.29.99; helo=mail.kernel.org; Received: from mail.kernel.org (198.145.29.99) by VE1EUR03FT004.mail.protection.outlook.com (10.152.18.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3520.15 via Frontend Transport; Wed, 28 Oct 2020 14:55:30 +0000 Received: from localhost.localdomain (unknown [95.145.162.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 57ABE247A8; Wed, 28 Oct 2020 14:55:27 +0000 (UTC) From: Catalin Marinas To: Will Deacon Subject: [PATCH v2] arm64: mte: Document that user PSTATE.TCO is ignored by kernel uaccess Date: Wed, 28 Oct 2020 14:55:24 +0000 Message-Id: <20201028145524.5489-1-catalin.marinas@arm.com> X-Mailer: git-send-email 2.20.1 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7a021870-3b32-4f8b-abe4-08d87b519cc5 X-MS-TrafficTypeDiagnostic: AM8PR08MB5841:|AM8PR08MB5828: X-MS-Exchange-AtpMessageProperties: SA x-checktessianinbound: true MS-Exchange-Organization-PhishThresholdLevel: 2 NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:8882;OLM:8882; X-Microsoft-Antispam-Untrusted: BCL:3; X-Microsoft-Antispam-Message-Info-Original: EEvTfKNw0dwXog2ZcQq45CfSVTagZXpUfYeF79wc4g/BpftEjY+F1VsYeqNlD5asUC21IGKWvj49t+QGaTZ+vIMDjPIDK7/XY/nUq2ZBVJw6L41+VLH2N1m1zyZTGL9tjSC0fxay6+3dijYSOxkI80absE+coepFNSiGQz0C/TmRXNfZJjMXqquNDcD/rNrXhxcwPa3Egc+PigNYi214CyUiMImKJ4Z4keZ2qjirXeNbATGUgoj1Z6YBCTTTETg4QQtIGbw+Z0x1ATIJJZMHkKz2DJJANAORYe2ORKtFKu6J+9y3GQSvytwEvv2Ksx1yteXHZCuAvP8Nld/S7vDiOQRZVCePjG8klDgsCDGXWoJBgVOj4zZLi922nVepWY79Xrrshzm4hQBd8tZY6B5zigiZQA0TUpWiLZk0812aOw9G2SLUJVIymMy6pGvpmGpAZX+DrLmasPCkd13znaq41hD9nNjAcjRHI4w1pScmLkA+CRrNFmMWLqU4TRDhGH0kXUoAeJk8pQezelvMUzn6cfENWzIhgkgbHQc7zSCshoqi9SeakPejqV88CjWn94GuLC2+uvu1s4O9nfLzE7OU3Ki5jnlgV2v/LoKIYa1V+0GHZ6HxYRmZBVlbXyLpirhIRDeXRWwErNWCEgqhjliysq7sPJnBa2q3bo2Va0d4mkE= X-Forefront-Antispam-Report-Untrusted: CIP:198.145.29.99; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.kernel.org; PTR:mail.kernel.org; CAT:NONE; SFS:(4636009)(286005)(7596003)(6266002)(7636003)(6862004)(44832011)(83170400001)(83380400001)(1076003)(6666004)(34756004)(2160300002)(42882007)(356005)(2616005)(336012)(36756003)(450100002)(4326008)(956004)(8676002)(6966003)(26005)(1096003); DIR:INB; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR08MB5841 X-OrganizationHeadersPreserved: AM8PR08MB5841.eurprd08.prod.outlook.com Original-Authentication-Results: spf=pass (sender IP is 198.145.29.99) smtp.mailfrom=kernel.org; arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=fail action=none header.from=arm.com;compauth=pass reason=704 X-MS-Exchange-Organization-ExpirationStartTime: 28 Oct 2020 14:56:12.5692 (UTC) X-MS-Exchange-Organization-ExpirationStartTimeReason: OriginalSubmit X-MS-Exchange-Organization-ExpirationInterval: 1:00:00:00.0000000 X-MS-Exchange-Organization-ExpirationIntervalReason: OriginalSubmit X-MS-Exchange-Organization-Network-Message-Id: 7a021870-3b32-4f8b-abe4-08d87b519cc5 X-MS-Exchange-Organization-MessageDirectionality: Originating X-MS-Exchange-SkipListedInternetSender: ip=[198.145.29.99]; domain=mail.kernel.org X-MS-Exchange-ExternalOriginalInternetSender: ip=[198.145.29.99]; domain=mail.kernel.org X-MS-Exchange-Organization-SCL: 1 X-CrossPremisesHeadersPromoted: AM5EUR03FT058.eop-EUR03.prod.protection.outlook.com X-CrossPremisesHeadersFiltered: AM5EUR03FT058.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT058.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-Organization-AuthSource: VE1EUR03FT004.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-Organization-AuthAs: Anonymous X-OriginatorOrg: arm.com X-MS-Office365-Filtering-Correlation-Id-Prvs: ea16780b-91ee-40c3-906e-08d87b5183a9 X-Microsoft-Antispam: BCL:3; X-Forefront-Antispam-Report: CIP:34.249.187.16; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.kernel.org; PTR:mail.kernel.org; CAT:NONE; SFS:; DIR:INB; X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2020 14:56:12.4913 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7a021870-3b32-4f8b-abe4-08d87b519cc5 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[34.249.187.16]; Helo=[64aa7808-inbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: VE1EUR03FT004.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR08MB5828 X-MS-Exchange-Transport-EndToEndLatency: 00:00:01.1493645 X-MS-Exchange-Processed-By-BccFoldering: 15.20.3499.018 X-Microsoft-Antispam-Mailbox-Delivery: ucf:1; jmr:0; auth:0; dest:C; OFR:CustomRules; ENG:(20160514016)(750128)(520002050)(944506458)(944626604); X-Microsoft-Antispam-Message-Info: iqCAsw5zoSF0jlnuDIUn+4tHerbSe7Zn2ZfKtSeY2vvbROVTULms5FGyD3qeuDvRyqTfK+QETHcnedHCM/QqJhlMdKYVBqDqsIRL+ZUqbrnXW68J/1lng4LwMqGMCiaxn3Hn/ezkMNf97rbha9btLRl4bVAVIfyhrlYN5DUojpOpF/u233GSm/VQax3hdML0iqUDXVe8HHBoWc2fEgMCBzsVwyl4aW++EaNZoQk4mG2+cDFYLTHfAzLYi2di10ThYsnP7L5E2uNlcqZ68jiXQEEZ504leetBMhFRgNGBYeJPooy0hqg7t29T0lwWxJURbv8dPWFXSOo4cM4Q6c2sXBMFDQYpeXkZbsE9GpFsFLKLQz9ehpugjlUxbYeNQbjPs0ubxWZrAqmc4OhNZ0aqm2W7FyqkE7GKDIofLf9WhSwi+OKu17htyGvg3dIz2yK7doGtm6pGd4xdg5Lv5PSdPyoPDUwbEqEYiWgsazw5OXxbKoV6r+hsoUArYz3jKxN+VFt2DJ6rFucGr1b9/ZmbCGHHKGr3VTFP1CrsSlGXK3r4Jy9JrPtw1w8wn2hj89noDRYMdT6K568roJnAA86UL3QHp2KkygI5o9/p01EBbSe6tJoa97EyFisX7ZuA5k2tes/Yv5HoRxkgVX1ENRqvtJFvfDAWmojRVrdwDD6Rn0zyoAoMuXCm4MY55Le+QpFfPFBPg2Mr5tRUHPFLyFQPBXPQj+7hLcvxY2KPGcDoPJRNMSlP8r69UOMBF6A6ZmPjWfsKViIHrc5hEOZzYXz831bI+CKTDTJJn9NtF4EJ2a3bE6aiLQdPrC5a8gWCz4J8tfw3ZiOjh62/Bb4Q3BpROA== MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201028_150705_559009_E9D98C66 X-CRM114-Status: GOOD ( 18.21 ) 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: Szabolcs Nagy , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On exception entry, the kernel explicitly resets the PSTATE.TCO (tag check override) so that any kernel memory accesses will be checked (the bit is restored on exception return). This has the side-effect that the uaccess routines will not honour the PSTATE.TCO that may have been set by the user prior to a syscall. There is no issue in practice since PSTATE.TCO is expected to be used only for brief periods in specific routines (e.g. garbage collection). To control the tag checking mode of the uaccess routines, the user will have to invoke a corresponding prctl() call. Document the kernel behaviour w.r.t. PSTATE.TCO accordingly. Signed-off-by: Catalin Marinas Fixes: df9d7a22dd21 ("arm64: mte: Add Memory Tagging Extension documentation") Reviewed-by: Vincenzo Frascino Cc: Will Deacon Cc: Szabolcs Nagy --- v2: Updated the text following Will's suggestion. Documentation/arm64/memory-tagging-extension.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Documentation/arm64/memory-tagging-extension.rst b/Documentation/arm64/memory-tagging-extension.rst index 034d37c605e8..b540178a93f8 100644 --- a/Documentation/arm64/memory-tagging-extension.rst +++ b/Documentation/arm64/memory-tagging-extension.rst @@ -102,7 +102,9 @@ applications. system call) are not checked if the user thread tag checking mode is ``PR_MTE_TCF_NONE`` or ``PR_MTE_TCF_ASYNC``. If the tag checking mode is ``PR_MTE_TCF_SYNC``, the kernel makes a best effort to check its user -address accesses, however it cannot always guarantee it. +address accesses, however it cannot always guarantee it. Kernel accesses +to user addresses are always performed with an effective ``PSTATE.TCO`` +value of zero, regardless of the user configuration. Excluding Tags in the ``IRG``, ``ADDG`` and ``SUBG`` instructions -----------------------------------------------------------------