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=-11.4 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS 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 B54FDC47096 for ; Fri, 4 Jun 2021 03:03:15 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2B33461407 for ; Fri, 4 Jun 2021 03:03:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2B33461407 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 6B9B76B0036; Thu, 3 Jun 2021 23:03:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 66A416B006C; Thu, 3 Jun 2021 23:03:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4E3F56B006E; Thu, 3 Jun 2021 23:03:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0243.hostedemail.com [216.40.44.243]) by kanga.kvack.org (Postfix) with ESMTP id 1BCC36B0036 for ; Thu, 3 Jun 2021 23:03:14 -0400 (EDT) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id B31438249980 for ; Fri, 4 Jun 2021 03:03:13 +0000 (UTC) X-FDA: 78214545066.18.8B1F675 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf17.hostedemail.com (Postfix) with ESMTP id A8A994211096 for ; Fri, 4 Jun 2021 03:03:00 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 1640161407; Fri, 4 Jun 2021 03:03:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1622775789; bh=FSL0mJu2p1n3VEX8k5+eJ5bhgTXJNBw7kXX50N9tM9w=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=blwTk5Lnd19UDXQeWY5cNBK5wB91NprTVCa5swAhRig0Qni5yqGQWWY6wd/EmzSlS 1WbT+89Pe/86snwflhpj/qbaBzjLWHDZulyjt6LBtD6Ucob7Ftwd15ZHHJgliQcVnA A7S2adVK7LVuBrhdCvmIYMA8tJVJ1prx6dAPJNx8= Date: Thu, 3 Jun 2021 20:03:08 -0700 From: Andrew Morton To: Peter Collingbourne Cc: Andrey Konovalov , Alexander Potapenko , Catalin Marinas , Vincenzo Frascino , Jann Horn , Evgenii Stepanov , linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v6 0/4] arm64: improve efficiency of setting tags for user pages Message-Id: <20210603200308.2a08d25db0dc92430a545b4c@linux-foundation.org> In-Reply-To: <20210602235230.3928842-1-pcc@google.com> References: <20210602235230.3928842-1-pcc@google.com> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=blwTk5Ln; spf=pass (imf17.hostedemail.com: domain of akpm@linux-foundation.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none X-Rspamd-Server: rspam03 X-Stat-Signature: 6eb1g35gnqcdap8u3m6sctmj5n71kfjt X-Rspamd-Queue-Id: A8A994211096 X-HE-Tag: 1622775780-363121 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 Wed, 2 Jun 2021 16:52:26 -0700 Peter Collingbourne wrote: > Currently we can end up touching PROT_MTE user pages twice on fault > and once on unmap. On fault, with KASAN disabled we first clear data > and then set tags to 0, and with KASAN enabled we simultaneously > clear data and set tags to the KASAN random tag, and then set tags > again to 0. On unmap, we poison the page by setting tags, but this > is less likely to find a bug than poisoning kernel pages. > > This patch series fixes these inefficiencies by only touching the pages > once on fault using the DC GZVA instruction to clear both data and > tags, and avoiding poisoning user pages on free. > > ... > > arch/alpha/include/asm/page.h | 6 +-- > arch/arm64/include/asm/mte.h | 4 ++ > arch/arm64/include/asm/page.h | 10 +++-- > arch/arm64/lib/mte.S | 20 ++++++++++ > arch/arm64/mm/fault.c | 26 +++++++++++++ > arch/arm64/mm/proc.S | 10 +++-- > arch/ia64/include/asm/page.h | 6 +-- > arch/m68k/include/asm/page_no.h | 6 +-- > arch/s390/include/asm/page.h | 6 +-- > arch/x86/include/asm/page.h | 6 +-- > include/linux/gfp.h | 18 +++++++-- > include/linux/highmem.h | 43 ++++++++------------- > include/linux/kasan.h | 64 +++++++++++++++++++------------- > include/linux/page-flags.h | 9 +++++ > include/trace/events/mmflags.h | 9 ++++- > mm/kasan/common.c | 4 +- > mm/kasan/hw_tags.c | 32 ++++++++++++++++ > mm/mempool.c | 6 ++- > mm/page_alloc.c | 66 +++++++++++++++++++-------------- > 19 files changed, 242 insertions(+), 109 deletions(-) This is more MMish than ARMish, but I expect it will get more exposure in an ARM tree than in linux-next alone. I'll grab them for now, but in the hope that they will appear in -next via an ARM tree so I get to drop them again.