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.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,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 B0B0BC83000 for ; Wed, 29 Apr 2020 15:24:53 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 7DD1F21D79 for ; Wed, 29 Apr 2020 15:24:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="BidH2SGG" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7DD1F21D79 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-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=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version: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=fI5ssnoogdqw5hCvpHZBJytutDst6AZiizCBvgTmDho=; b=BidH2SGGN7oBTU W1rcrcIYtjf0JjIrJc4cIr1FLze2TNzOoik3UwiDpllfbK54ZYLU8HD94oiQS1dbId3wr5yWtDuq5 ujv67T4AgHnAyd+N3Y+Mo8ujE1iZiKSp4ObPntMIrGaLYWENS7Dl59IQXJAky1p4MPqWIr+8kt6FD yO45GipQ/+S8Vfttln3XQ+fc2XIVIynot5zUWICQoH52AI2El8znze2VDRwQ3ktXyNCd3XmnnZKEp 1sTmEdJd+3mTzWRfn6iFGTeGs9InDijghDdUFShMQQAKaYRYakad8JsZjSc49zbsBAmur8fINLF9F ZK7mc0nhr+rxuZqO4dxw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jToZw-00043p-Mz; Wed, 29 Apr 2020 15:24:52 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jToZt-00042i-7e for linux-arm-kernel@lists.infradead.org; Wed, 29 Apr 2020 15:24:50 +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 64F0A1045; Wed, 29 Apr 2020 08:24:48 -0700 (PDT) Received: from gaia (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8FD523F68F; Wed, 29 Apr 2020 08:24:46 -0700 (PDT) Date: Wed, 29 Apr 2020 16:24:44 +0100 From: Catalin Marinas To: Kevin Brodsky Subject: Re: [PATCH v3 19/23] arm64: mte: Add PTRACE_{PEEK,POKE}MTETAGS support Message-ID: <20200429152443.GD10651@gaia> References: <20200421142603.3894-1-catalin.marinas@arm.com> <20200421142603.3894-20-catalin.marinas@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200429_082449_327216_F6E75E99 X-CRM114-Status: GOOD ( 17.90 ) 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: linux-arch@vger.kernel.org, Richard Earnshaw , Luis Machado , Omair Javaid , Szabolcs Nagy , Andrey Konovalov , Peter Collingbourne , linux-mm@kvack.org, Alan Hayward , Vincenzo Frascino , Will Deacon , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Apr 29, 2020 at 11:27:10AM +0100, Kevin Brodsky wrote: > On 21/04/2020 15:25, Catalin Marinas wrote: > > diff --git a/arch/arm64/lib/mte.S b/arch/arm64/lib/mte.S > > index bd51ea7e2fcb..45be04a8c73c 100644 > > --- a/arch/arm64/lib/mte.S > > +++ b/arch/arm64/lib/mte.S > > @@ -5,6 +5,7 @@ > > #include > > #include > > +#include > > /* > > * Compare tags of two pages > > @@ -44,3 +45,52 @@ SYM_FUNC_START(mte_memcmp_pages) > > ret > > SYM_FUNC_END(mte_memcmp_pages) > > + > > +/* > > + * Read tags from a user buffer (one tag per byte) and set the corresponding > > + * tags at the given kernel address. Used by PTRACE_POKEMTETAGS. > > + * x0 - kernel address (to) > > + * x1 - user buffer (from) > > + * x2 - number of tags/bytes (n) > > + * Returns: > > + * x0 - number of tags read/set > > + */ > > +SYM_FUNC_START(mte_copy_tags_from_user) > > + mov x3, x1 > > +1: > > +USER(2f, ldtrb w4, [x1]) > > Here we are making either of the following assumptions: > 1. The __user pointer (here `from`) actually points to user memory, not > kernel memory (and we have set_fs(USER_DS) in place). > 2. CONFIG_ARM64_UAO is enabled and the hardware implements UAO. > > 1. is currently true because these functions are only used for the new > ptrace requests, which indeed pass pointers to user memory. However, future > users of these functions may not know about this requirement. > 2. is not necessarily true because ARM64_MTE does not depend on ARM64_UAO. > > It is unlikely that future users of these functions actually need to pass > __user pointers to kernel memory, so adding a comment spelling out the first > assumption is probably fine. I found it easier to add uao_user_alternative rather than writing a comment ;). Thanks. -- Catalin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel