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.6 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 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 CD0CDC433E0 for ; Wed, 27 May 2020 07:47:07 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 91A4A20EDD for ; Wed, 27 May 2020 07:47:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="LVeFzpVd" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 91A4A20EDD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 28548800B6; Wed, 27 May 2020 03:47:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2356880010; Wed, 27 May 2020 03:47:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 171AC800B6; Wed, 27 May 2020 03:47:07 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0089.hostedemail.com [216.40.44.89]) by kanga.kvack.org (Postfix) with ESMTP id 060B780010 for ; Wed, 27 May 2020 03:47:07 -0400 (EDT) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 6237B180AD811 for ; Wed, 27 May 2020 07:47:05 +0000 (UTC) X-FDA: 76861718010.06.story59_2514f5726d50 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin06.hostedemail.com (Postfix) with ESMTP id 3CFB3100528E9 for ; Wed, 27 May 2020 07:47:05 +0000 (UTC) X-HE-Tag: story59_2514f5726d50 X-Filterd-Recvd-Size: 4021 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf05.hostedemail.com (Postfix) with ESMTP for ; Wed, 27 May 2020 07:47:04 +0000 (UTC) Received: from willie-the-truck (236.31.169.217.in-addr.arpa [217.169.31.236]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4A0BD207CB; Wed, 27 May 2020 07:47:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590565624; bh=/FVQ3sLZUY/KzEKvgBXodRAdsyRqYRRArkYuCnMkydY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=LVeFzpVdK/UfgPBIOmXoKNIzgx0gyeybY/yzjW9JfmshAD076tdIm8WEbWr9uII4S WXSdBD994NaKD8njjZAuYD4+sQJyHg9UtzIEBh5m8MWiUyZS/QNILopeSK3OP2I3IP FABRqUXF/55oL2QMxAZ5l3ouZLJiePenMtgCn6/c= Date: Wed, 27 May 2020 08:46:59 +0100 From: Will Deacon To: Catalin Marinas Cc: linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, Dave P Martin , Vincenzo Frascino , Szabolcs Nagy , Kevin Brodsky , Andrey Konovalov , Peter Collingbourne Subject: Re: [PATCH v4 15/26] arm64: mte: Allow user control of the tag check mode via prctl() Message-ID: <20200527074658.GB9887@willie-the-truck> References: <20200515171612.1020-1-catalin.marinas@arm.com> <20200515171612.1020-16-catalin.marinas@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200515171612.1020-16-catalin.marinas@arm.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Rspamd-Queue-Id: 3CFB3100528E9 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam03 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri, May 15, 2020 at 06:16:01PM +0100, Catalin Marinas wrote: > By default, even if PROT_MTE is set on a memory range, there is no tag > check fault reporting (SIGSEGV). Introduce a set of option to the > exiting prctl(PR_SET_TAGGED_ADDR_CTRL) to allow user control of the tag > check fault mode: > > PR_MTE_TCF_NONE - no reporting (default) > PR_MTE_TCF_SYNC - synchronous tag check fault reporting > PR_MTE_TCF_ASYNC - asynchronous tag check fault reporting > > These options translate into the corresponding SCTLR_EL1.TCF0 bitfield, > context-switched by the kernel. Note that uaccess done by the kernel is > not checked and cannot be configured by the user. > > Signed-off-by: Catalin Marinas > Cc: Will Deacon > --- > > Notes: > v3: > - Use SCTLR_EL1_TCF0_NONE instead of 0 for consistency. > - Move mte_thread_switch() in this patch from an earlier one. In > addition, it is called after the dsb() in __switch_to() so that any > asynchronous tag check faults have been registered in the TFSR_EL1 > registers (to be added with the in-kernel MTE support. > > v2: > - Handle SCTLR_EL1_TCF0_NONE explicitly for consistency with PR_MTE_TCF_NONE. > - Fix SCTLR_EL1 register setting in flush_mte_state() (thanks to Peter > Collingbourne). > - Added ISB to update_sctlr_el1_tcf0() since, with the latest > architecture update/fix, the TCF0 field is used by the uaccess > routines. > > arch/arm64/include/asm/mte.h | 14 ++++++ > arch/arm64/include/asm/processor.h | 3 ++ > arch/arm64/kernel/mte.c | 77 ++++++++++++++++++++++++++++++ > arch/arm64/kernel/process.c | 26 ++++++++-- > include/uapi/linux/prctl.h | 6 +++ > 5 files changed, 123 insertions(+), 3 deletions(-) Dave is working on man pages for prctl() (and I think also ptrace). I think it would be /very/ useful for us to have some RFC patches on top of his work adding documentation for the MTE interactions, as we found some other minor issues/inconsistencies as a direct result of writing and reviewing the man page for our existing interfaces. Cheers, Will