From patchwork Wed Mar 29 18:37:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: andrey.konovalov@linux.dev X-Patchwork-Id: 13193125 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id CD78DC761AF for ; Wed, 29 Mar 2023 18:38:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B75396B0078; Wed, 29 Mar 2023 14:38:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 986BE6B007B; Wed, 29 Mar 2023 14:38:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6EFBA900003; Wed, 29 Mar 2023 14:38:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 56C256B0078 for ; Wed, 29 Mar 2023 14:38:03 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 32FBE160E14 for ; Wed, 29 Mar 2023 18:38:03 +0000 (UTC) X-FDA: 80622795246.24.7F4BFF3 Received: from out-18.mta1.migadu.com (out-18.mta1.migadu.com [95.215.58.18]) by imf11.hostedemail.com (Postfix) with ESMTP id 6B31C4000A for ; Wed, 29 Mar 2023 18:38:01 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=QgAd4ttX; spf=pass (imf11.hostedemail.com: domain of andrey.konovalov@linux.dev designates 95.215.58.18 as permitted sender) smtp.mailfrom=andrey.konovalov@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1680115081; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=4IBB0t30IQWFgjzMoDMwNtgr4khYAd9V6YJirYANKJw=; b=MClE0Ok1XuJDpQhbH/yVyCoGhmYUH+TzzSvk2tvqSI5892w7+PzvikrTJNyphJdbSPegg5 fGZcpfNii6HhZjBth4adV9vE41INlarEIQqyWpglmCea+aqlDEpTUeaPpj6mcIsckE6qpt h0T1uycNqSsVYC4uW8SzkTr5Ckm5V/E= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=QgAd4ttX; spf=pass (imf11.hostedemail.com: domain of andrey.konovalov@linux.dev designates 95.215.58.18 as permitted sender) smtp.mailfrom=andrey.konovalov@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1680115081; a=rsa-sha256; cv=none; b=NTtG7ra2DaUgr9KOuwnrbHYyuniaIYP5bYGyA5Qw3o3tRC7cIxhya+DRXXGOcvBrbMdsZj Dgd1RYOU8KeHjigksxOMyy8xgk0N6or7JPDLpcnIb3mPJ9Eqnq961UyC0GpxOMukSLjKt8 cxxkIHyU+dGDgnM039z7EkSJ6YMzJYQ= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1680115080; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4IBB0t30IQWFgjzMoDMwNtgr4khYAd9V6YJirYANKJw=; b=QgAd4ttXeu2KtUbjd+eYGisjZq9ioQEf7KHQO41mUQEncgqcvFT0kMtVWTnVhTvqO39dCs qnfT8VmxT5x2t4jFNaIYtC86D2toghjLwz4S6LnFhsQ33dWNChtMewppVDGTmO1JwwMcY9 /ZquEfYJhPqccz/gfQ0PZ1hFiaHWscc= From: andrey.konovalov@linux.dev To: Marco Elver , Catalin Marinas Cc: Andrey Konovalov , Alexander Potapenko , Dmitry Vyukov , Andrey Ryabinin , kasan-dev@googlegroups.com, Vincenzo Frascino , Will Deacon , linux-arm-kernel@lists.infradead.org, Peter Collingbourne , Evgenii Stepanov , Andrew Morton , linux-mm@kvack.org, Weizhao Ouyang , linux-kernel@vger.kernel.org, Andrey Konovalov Subject: [PATCH v2 4/5] kasan, arm64: add arch_suppress_tag_checks_start/stop Date: Wed, 29 Mar 2023 20:37:47 +0200 Message-Id: <7ad5e5a9db79e3aba08d8f43aca24350b04080f6.1680114854.git.andreyknvl@google.com> In-Reply-To: References: MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 6B31C4000A X-Stat-Signature: gd7nmwjjabaayi5sdqr5nb4sga1eg11x X-Rspam-User: X-HE-Tag: 1680115081-501746 X-HE-Meta: U2FsdGVkX1+KO1w7T+CGcEoD/ldcb1gJsnuVRXiXYVoECpnts0JlUNtgZp1OFDeWVqtju66i5Eovd8BzIXwuUAxkBhAGNWYOibu3z0Zga2BFprbDsv0DlhTKX8Tve6ruSp8Vi2l3Vh7/vJqAD6LCdgiksd8lPiZHyQLwcwBgKPm/yqiwfQoMIuNpCLoiQpEXR6EyDAS6RDWIVkkY0KnEwwm9WdQInwU1QEfgPkVUzpg99dzxZRFzxMPefRvqCi0+a2SS25O3nIIEiVIx2lBp8QoXAw7h3s0jKKDSJufm/o9Cr/pS+//cMGCXj8KEXbsaA+uzOoU96wuFGUG4XiQPVjW9KSmk1l6LrsQ2FjrXj4Hmrffbl6vn+FyiO4p24m7QEQpPFeTKBNPWKep+1mCIMouxg840Rh/69AX24e9J+g8CtUmVlhBAjzY8+zepq1XqZYNwc9uxuZarVSErvzZJ4hJXX1m5EJa3NrSTQZgY8ws0aFss3V4GwS+uXnzA3T+qz9hA+Edoxv6LQFvIbp3anbmrdCJa9RN4vgAdd4T3IWC5DpOhs4W0Gq7o7EHUOYaRmkapEaTxzJRtLgsBJ7AVrm7y2K08M0Gy/s+PMAZvny7uqtm5tKk51K4/1wHXMDGnLC+rU0MK0fLwsBU4PZAF7kF7dyUgzs8/TMQaBZrV4p8TB7JbanROK0sDiksE0pt36I2S5EokyWTZamKmL3AXCiG0MwBRRWyWH9p+Zzx0QwYBJa8FcS5N4rG2I/Lxw4+qC3Te/kyqftuc0D+byCtppzKuSjJuRXhGsx+My8dgjDTtnWRsre19YLhIsuXpf9zw10g9EkAvbYKdK/opH3h8FGf7e9+FHCzJkqvKY2h6EvEuJVEIfpkyDbXB2y3LsxNdTmOVDnTWjhnxOmPnrQjeu8yHP0WVnKvNyBNIIlmM+eSRorWdsBCXeOnRGrCKNCVeyXuhv9j7V2j0yP4zd+W rRfWzZBe S9VRi6o+M6qFnwNpBXDUKMQ4v4oqQxs8TjP+H/41aj3mmVE+cSoJEgNxbW5sY7y8CIwuwzdd3wAEbqN0HaFPkPiYpUJKnmNSGH+EI52xg05M0nn5xatUzhipYrl1ABcjAT+nT+IIjyJtkQaivOMsz20r9OCfpzBmT8iwgYSxVpjDmT6o5bie5Qpuysu+AIvhXvPyofQAyP+1qRHKXTQeWGmQWS+CIcIePAhsf+97xYInMTY4= 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: From: Andrey Konovalov Add two new tagging-related routines arch_suppress_tag_checks_start/stop that suppress MTE tag checking via the TCO register. These rouines are used in the next patch. Signed-off-by: Andrey Konovalov --- arch/arm64/include/asm/memory.h | 2 ++ mm/kasan/kasan.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h index faf42bff9a60..05e42bd3555f 100644 --- a/arch/arm64/include/asm/memory.h +++ b/arch/arm64/include/asm/memory.h @@ -264,6 +264,8 @@ static inline const void *__tag_set(const void *addr, u8 tag) #define arch_enable_tag_checks_sync() mte_enable_kernel_sync() #define arch_enable_tag_checks_async() mte_enable_kernel_async() #define arch_enable_tag_checks_asymm() mte_enable_kernel_asymm() +#define arch_suppress_tag_checks_start() mte_enable_tco() +#define arch_suppress_tag_checks_stop() mte_disable_tco() #define arch_force_async_tag_fault() mte_check_tfsr_exit() #define arch_get_random_tag() mte_get_random_tag() #define arch_get_mem_tag(addr) mte_get_mem_tag(addr) diff --git a/mm/kasan/kasan.h b/mm/kasan/kasan.h index a1613f5d7608..f5e4f5f2ba20 100644 --- a/mm/kasan/kasan.h +++ b/mm/kasan/kasan.h @@ -398,6 +398,8 @@ static inline const void *arch_kasan_set_tag(const void *addr, u8 tag) #define hw_enable_tag_checks_sync() arch_enable_tag_checks_sync() #define hw_enable_tag_checks_async() arch_enable_tag_checks_async() #define hw_enable_tag_checks_asymm() arch_enable_tag_checks_asymm() +#define hw_suppress_tag_checks_start() arch_suppress_tag_checks_start() +#define hw_suppress_tag_checks_stop() arch_suppress_tag_checks_stop() #define hw_force_async_tag_fault() arch_force_async_tag_fault() #define hw_get_random_tag() arch_get_random_tag() #define hw_get_mem_tag(addr) arch_get_mem_tag(addr)