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: 13193128 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 70344C74A5B for ; Wed, 29 Mar 2023 18:39:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=shGqY1N35r/rVo3ruT18hb7eBbfkrZ0UnEyA/Ps+gA8=; b=FQYVgsBj421OKb lg+znoej4vFva8r6rAFEJ6djxqlKgAor4icW/4PH0c4W45j7ow9+LnRbYXFkeWm7X9UKJf1Z/Xk0x edNnV2Ji2hWvfB1BZV9j6Rrcimk7NN2FeA4OJXEpPJhWvqeQFWFv3VCloqnqk6S/CeadaAGFjuNmo jlq2z3fwmZuNWkhu91m+bCUG+HpYnx0HBf6m8jisplfANFKTvHbbONRjCvCoowkh1F/jn2sqUz2hM 28JMTvnoN6Wm6BGRVVImWeq/eizU8X0D+qo2NUSBGPzGKGd+iLrcB56a9bCVMkxhq7AaPz2p2+5Ku sjRS7vs9z95Vrk7LxdFw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1phagc-001UcR-0D; Wed, 29 Mar 2023 18:38:18 +0000 Received: from out-18.mta1.migadu.com ([2001:41d0:203:375::12]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1phagP-001UUI-0d for linux-arm-kernel@lists.infradead.org; Wed, 29 Mar 2023 18:38:06 +0000 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230329_113805_377925_247A8B70 X-CRM114-Status: UNSURE ( 7.99 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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)