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: 76766 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp616058vqo; Wed, 29 Mar 2023 11:45:02 -0700 (PDT) X-Google-Smtp-Source: AKy350ZfKRVK/hnBG+Dhv05NZtMH0fJ1Vp2j5TPZAmFW4z/ea1gvAeu6C40VYrDx0OqEI1LlJni3 X-Received: by 2002:a17:906:ad9:b0:930:8714:6739 with SMTP id z25-20020a1709060ad900b0093087146739mr19544979ejf.30.1680115502498; Wed, 29 Mar 2023 11:45:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680115502; cv=none; d=google.com; s=arc-20160816; b=sRaavWKrBUzrKw2rClAYlECBzcph8ct93vgaGJBZK89VAqMUfZN82InLFZDFxkB/qI hkyYthvntiWJDDAbbtC0zrL5OcunbECdZw6q4+RnJJAP2NbIL4SSDkHjNCsVftXyYNPx Mx4e5UAVNW30/8fjRDgwA1h6oC1AC8uzE+QiDfuiiO8lXPsuR/VL+COpbpoDS6tGG5pF lyTnS9sNVjIFhzLsJcWlYdK7DKRD/L7bWcZunLvaRr8jU39QtTYtkbnULHCaw3+icLo4 4/wJIOMF3YLc8YL4aOaMHHhA2JkvRsJWwxR9Boc7HXAZrjjeH9l8nQ/dhBo//NlC+0N3 vBHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=4IBB0t30IQWFgjzMoDMwNtgr4khYAd9V6YJirYANKJw=; b=ENVTbs2MRwvkOyoakCbj5tIKAzAIZIOMKI7rZu7Ws6N+p4Xmw9BE69MBizQnHj76Ly sLYxZF94Fx9apKcqpdmDW9W2GsRcWmV9OPfnKnkTSzoXFhs6xi1Zst5yoU8PIeJm9hbb XDD+kFAk60x6A9zs0RDx8jgryJMJ/P8kre0CH3aVIKTAll8fgM2GBsZj+dsMyFYE/0XY ThViRcR9LHU4IW21FqA5aN4VgN2tJ7AlkWqYr7gel0Ohcl8UnMNO5yayfoRB4Yz6mR0I bfmx2lm7JgRn68ZWEF62NwJAjJ7uIRNPysGfocpEzwnV7Ds1HkGlm9/t7VMIT+H4H4k1 +jRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=QgAd4ttX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d5-20020a50fb05000000b004ad0993e54esi33744220edq.487.2023.03.29.11.44.38; Wed, 29 Mar 2023 11:45:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=QgAd4ttX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229687AbjC2SiM (ORCPT + 99 others); Wed, 29 Mar 2023 14:38:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229638AbjC2SiF (ORCPT ); Wed, 29 Mar 2023 14:38:05 -0400 Received: from out-10.mta1.migadu.com (out-10.mta1.migadu.com [IPv6:2001:41d0:203:375::a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5F571FDA for ; Wed, 29 Mar 2023 11:38:01 -0700 (PDT) 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-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761728793005074890?= X-GMAIL-MSGID: =?utf-8?q?1761728793005074890?= 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)