From patchwork Fri Mar 10 23:43:32 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: 13170463 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 54F78C74A4B for ; Fri, 10 Mar 2023 23:43:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 218816B007E; Fri, 10 Mar 2023 18:43:43 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 19FBB8E0001; Fri, 10 Mar 2023 18:43:43 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EBF686B0082; Fri, 10 Mar 2023 18:43:42 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id CF11C6B007E for ; Fri, 10 Mar 2023 18:43:42 -0500 (EST) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id A3222AAF0F for ; Fri, 10 Mar 2023 23:43:42 +0000 (UTC) X-FDA: 80554618284.04.94D4E90 Received: from out-48.mta1.migadu.com (out-48.mta1.migadu.com [95.215.58.48]) by imf02.hostedemail.com (Postfix) with ESMTP id 032ED80005 for ; Fri, 10 Mar 2023 23:43:40 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=KexIs4rR; spf=pass (imf02.hostedemail.com: domain of andrey.konovalov@linux.dev designates 95.215.58.48 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=1678491821; 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=oDcuLSEdW7dG92xT5iE2ytpvV+VW7Ad9krPNXrfRPwk=; b=4GKqnM/cpKeDYWwS8u0K+HLLYaSaVE55WZ72EezQmggSlrMzFdzYvlmM9x/Ab0G/juvQCl UyAzoQrHlLIWeSZes86iT0U5c4d2IbSpGtwI9AqdMIur1r/Rk6kBpQtsRtOBUVrT51aL/g v13X7Yha9MBwnDUoMq9/oBY/Wep9e5g= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=KexIs4rR; spf=pass (imf02.hostedemail.com: domain of andrey.konovalov@linux.dev designates 95.215.58.48 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=1678491821; a=rsa-sha256; cv=none; b=f9Wik6krqxTnYpI/vnuEgjOt0/mCpoq0Nf8GJ/KUAQM5pv9ux0tfjRwnOJXhtDd8LzI761 0MicNKfnLrcfSKAc7cm3tg+NSC61mPw9WjYQ4B9ewgF/HM5fDdTFjpAnXY1Z8VWP34Ylkz 1AMlQxwAWs0l2vD/jrscfFvlaFaZ8XM= 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=1678491819; 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=oDcuLSEdW7dG92xT5iE2ytpvV+VW7Ad9krPNXrfRPwk=; b=KexIs4rR+UsVNXfzaoUthnE4Zbw7zg7FNPT1gxekp2AoL8vszqK4xiGhWr5TmHD2jr8GWb BcXN/UzGm+jLdtXRx5SulvVCeqYlSYgPb2IMtufbXS+i6OtCgvmlZON6FPzRzs7b1SLvyI KHBEnNEQalESu+M+IiALcpwFpnj1LG4= 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 4/5] kasan, arm64: add arch_suppress_tag_checks_start/stop Date: Sat, 11 Mar 2023 00:43:32 +0100 Message-Id: <75a362551c3c54b70ae59a3492cabb51c105fa6b.1678491668.git.andreyknvl@google.com> In-Reply-To: References: MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 032ED80005 X-Stat-Signature: 4ejunxrajoejdfpy9cxb5q684t8m5ddm X-HE-Tag: 1678491820-287188 X-HE-Meta: U2FsdGVkX18qX2uku28r10dkFF2Zner6rTgSr7xo3YyzZMA1y5hkb9WIimh6ad4NbV18ngh+yUpvMAZUAsVw1OObrLX6xO9uNwTEN6C901N9cc3y1rGAo8F6+DRq7VospZZuGCuDm5jvKl4u9+DcGYYp5IJKGU8exJ6MATBwowa1Fjdr8Bb6TtJ4BRqThJ3GLzs+CVgKgih+rx0hdrk932x7HIiDoprdF+5cc/lcP3TH0UuDJgNqFGW26agZczicxgPmuv49DRGjHVGuQ4WOhjCQnUMye57y8YLdmoR89DupddWmJSeAtRKmbqf7mnsw45Uye4IzTddfPv7g/EwRPQygbiXchsGSDKG56pX3hcPOujpJYOkHNdlB0/PSyzPeDdgTgSqyZ/hb0QVvCxQffgAbuuWPy4d5t4xmIWj0e7JHlNgikMFB69Ezrk93sVt8iP8sBNUUR0g2YrCBO+5NKgp8B07Byvozzh56elCaNeErG49uvKEp2LmWi5G4kFLe/StSrpMPO/w3PJ8UvcSzQzZp7rZ3sDzfW6f/m6mZXLundL3HYlJf2sKfK8M6VDiNIlhUkUEZi1/kF/VOoS1qwP/g0Cm/ZUnisLwaproOT+74xlNpSqVNLYjo80/Y545/DoKF0i2olC8MIKGxEJyzWKy6nHZE10stYJC9rKpgjuWGpVo8Y4ZQROT9W152EGkZjSNhVyWEDCq/qH2XAlI3r4c/0hD7qPClfx3mbcMmBHl0xpzp4Q4RGlnWkpJtJswkZEWAtVgfdCZpB+mt9hGoyT8VVOJg3MlDbOLF3zozUUExMC4+h2y08i8nyEfBnDTUhH3ZutGLFEkXAmMX3vPT5XPQwRIVdbN7p9F7q8ee7P+c2rtvmOZ0r7P2s7Qg4vArDsFQyVytwNGzmy+5/Fnp3WMwFq+wVV+Ir0ZmRWyTDd6VdNCFBGAi3QYsVLo5HPBE2LRfjLHDUNmrOvSymEL gTHG4m0a ycel0DGhz9NxwdOBPq5TE0huAKmYn1F12j6vq8DIPH4stFQiMC+pZlEZeG6/2OpxoLGCiG/Gsfm37V5QK2IHhgwuWUlpXYf59AlhCzdaz/t1FvZe9Er+PtE3S83Su38/7FdxrqLQYu77La/bqY5ejBZVjfsNeNdxiiWLL0YcbVzRM0qqFAiTFXu/8nAwuj4RGthkTgjwnxOH+3bJULARi1lZcgwmhPNMySqJz1cmP7CAAZyg= 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..26bd4d9aa401 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)