From patchwork Wed Feb 15 13:00:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 13141621 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 182F2C6379F for ; Wed, 15 Feb 2023 13:01:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7A3C16B0073; Wed, 15 Feb 2023 08:01:22 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 72D2E6B0074; Wed, 15 Feb 2023 08:01:22 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5CEF56B0075; Wed, 15 Feb 2023 08:01:22 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 4D01F6B0073 for ; Wed, 15 Feb 2023 08:01:22 -0500 (EST) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 1CE1D406BA for ; Wed, 15 Feb 2023 13:01:22 +0000 (UTC) X-FDA: 80469537204.26.B4DF3D2 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf13.hostedemail.com (Postfix) with ESMTP id 235DA20027 for ; Wed, 15 Feb 2023 13:01:18 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=R0VoQz6v; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf13.hostedemail.com: domain of arnd@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=arnd@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1676466079; 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=eEGF2dhJHQrOcjGWiEp/1K3Pqyv63qcrypNyumV54Yg=; b=y6GsKvaXQoAYpbEYQXtTGr8BmW41QIYh2jLRt8XL6mnFZIGj2C/Qo9qXfkuXK3q8/zp4vN vP5xD0sip4nRj+SLXhOVQO77jcaJYSWIDcuVMtqzhcyFivu4Fil8oPjLSaKThx0+N6M8rK c0q7HgzfdJ3CQ8p7xSODUWvuSinH3Nk= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=R0VoQz6v; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf13.hostedemail.com: domain of arnd@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=arnd@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1676466079; a=rsa-sha256; cv=none; b=ywsKUV2oHzyAxzR+4YaaDmNq4uweGQiSmIM1E9dIzDgvE0pF0OyXs42BUR316D3+4tLMrH QkB9RUZgqXpSYUupfb/Pv74R37A3J4unfSGBTI34pDDTxeizrN+dT7/ozRaj3+DO2vhboK 62HC4DuNBqnD8tk9sXCoyqUcFJCxhFQ= Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9CC17B8212A; Wed, 15 Feb 2023 13:01:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6819BC4339B; Wed, 15 Feb 2023 13:01:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1676466076; bh=gjHAHHqwYm8o1x992R2kWv27BpeHlDcrRDtNIB6oM0s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R0VoQz6vcJRMvwJmX8jY9JYLJ6IEQOqKG5hN5MD23CQx5K1TPX4HjelS4VNioCyw3 rRxumsiccf2phYjGDdQoD3SeM5AZmc6cvjwZOvxHWTc7NiBmbiL8nPtDgsnB1Jq3VH JAYDeL/C0k2JAfyi1BNJVf4BvguAmuyg/PmI++jrkzaYSGIN8RysFq6bJzEuLGj04Q HT0tIBlddiEC6XTcvgm7A2hdOIx6kcZAuIlkjEwzBSYfje5AnZ3Aq+bpjPsBy105BX 37oYXOxUG6vwUT06gEDFQ/0EXnoWg6kDAOGQfeO58yaYtOsG3XL1eXaETFTDTIozDq APgN5Cqa7Mg9g== From: Arnd Bergmann To: Andrew Morton , Josh Poimboeuf , Peter Zijlstra Cc: Arnd Bergmann , Alexander Potapenko , Andrey Konovalov , Andrey Ryabinin , Dmitry Vyukov , Kuan-Ying Lee , Marco Elver , Vincenzo Frascino , kasan-dev@googlegroups.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/3] [v2] kasan: mark addr_has_metadata __always_inline Date: Wed, 15 Feb 2023 14:00:56 +0100 Message-Id: <20230215130058.3836177-2-arnd@kernel.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230215130058.3836177-1-arnd@kernel.org> References: <20230215130058.3836177-1-arnd@kernel.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 235DA20027 X-Stat-Signature: ynz8znk6kxkim5jodrdd7oyhcjy6hhf8 X-HE-Tag: 1676466078-309607 X-HE-Meta: U2FsdGVkX19XHEtg6Z8UbcHPmrBjsqOPYRlmNbNGdnUrV46CXnCsJUgJGH/v0oBIENSXRw9rSdErmiOZ05przfk0ouNb03SxU296wTLFnoDU+2MSU1RF8DON18klJjT/f1rnBTWBQj30thUrllmYBkf1fWXr2b0swNCjVoqX7WFshgd+E2xDygvWyvIt2fCUlOulyBkH1orOpcpi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rg5JOMs7A62Tv/fvG0iVNYlP/N7Wu+MsWhWolxhx3d0TS8hyp/wnEA/LQnz4h3IGO0Xqko7pwo2WrtVx65pQwHP0clhgCNNcmLJ3fty2kb2+HQEfDnmHtw5SnnA/R8yj0psB99cNvq7XOyq/VkCsgJsk8ywhgUuKEoqj0kKOX/DKERwicqLYVBVFt7T6XjZuEeguA4/p+R3CnyWSyjk4QmTfWFfkGpQO3hKLY= 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: Arnd Bergmann When the compiler decides not to inline this function, objtool complains about incorrect UACCESS state: mm/kasan/generic.o: warning: objtool: __asan_load2+0x11: call to addr_has_metadata() with UACCESS enabled Acked-by: Peter Zijlstra (Intel) Reviewed-by: Marco Elver Reviewed-by: Andrey Konovalov Signed-off-by: Arnd Bergmann --- v2: fix objdump/objtool typo --- mm/kasan/kasan.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/kasan/kasan.h b/mm/kasan/kasan.h index 3231314e071f..9377b0789edc 100644 --- a/mm/kasan/kasan.h +++ b/mm/kasan/kasan.h @@ -297,7 +297,7 @@ static inline const void *kasan_shadow_to_mem(const void *shadow_addr) << KASAN_SHADOW_SCALE_SHIFT); } -static inline bool addr_has_metadata(const void *addr) +static __always_inline bool addr_has_metadata(const void *addr) { return (kasan_reset_tag(addr) >= kasan_shadow_to_mem((void *)KASAN_SHADOW_START)); @@ -316,7 +316,7 @@ bool kasan_check_range(unsigned long addr, size_t size, bool write, #else /* CONFIG_KASAN_GENERIC || CONFIG_KASAN_SW_TAGS */ -static inline bool addr_has_metadata(const void *addr) +static __always_inline bool addr_has_metadata(const void *addr) { return (is_vmalloc_addr(addr) || virt_addr_valid(addr)); } From patchwork Wed Feb 15 13:00:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 13141622 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 44631C636CC for ; Wed, 15 Feb 2023 13:01:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C38766B0074; Wed, 15 Feb 2023 08:01:24 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B9A1A6B0075; Wed, 15 Feb 2023 08:01:24 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9ECD56B0078; Wed, 15 Feb 2023 08:01:24 -0500 (EST) 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 8E0D36B0074 for ; Wed, 15 Feb 2023 08:01:24 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 5ABA91204BB for ; Wed, 15 Feb 2023 13:01:24 +0000 (UTC) X-FDA: 80469537288.02.077B8A8 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf02.hostedemail.com (Postfix) with ESMTP id 7AC1C80031 for ; Wed, 15 Feb 2023 13:01:22 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="Lu0J/SbI"; spf=pass (imf02.hostedemail.com: domain of arnd@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=arnd@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1676466082; 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=BcBkGQIO+rb2iXcsy77cxTrQw5FMHDgpD40SU+OF/kE=; b=covkCnfWeCaWUiWzoYCQwCJ3cjzl8vu6QSghXune5gEayJx9GrXx8I3mjjy3/aEoPPu850 nLsVSC+8UKeLVwT/8SSMEtO1D7KgOFLx1qUQc+RGyuo5VwzxcEg5ByLuyBuSMbTZ1NGXx8 WYSakaCespHbajZ1FNd9L4fO7u4Rld8= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="Lu0J/SbI"; spf=pass (imf02.hostedemail.com: domain of arnd@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=arnd@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1676466082; a=rsa-sha256; cv=none; b=qahcv5HOTNFa+71Qe5z/ClDfc3utbkpukBaceuaj1E2eszu/x+KMX0A4xiGRqnviG8qZsW 2O4spRhqmQMfnSgCQPJIdg7ujax60JO39sQPGMplLlaaVHKYSzUG7MvOqMDa+RRE0M4OIj E0nElRytnyiPiardK33mSsoT45ulu8E= Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 11E49B820DA; Wed, 15 Feb 2023 13:01:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D33BFC4339C; Wed, 15 Feb 2023 13:01:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1676466079; bh=2ZHB4kXmO9QIInQQshGPPjNMQQVO/B7ppuR6Groskjg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Lu0J/SbIWS9+ixPccMmPzBFd9wQGiDgHS5tGpdfzu2X1ttNScPufVWKN4YxkY+2Fd yEvd/lrDUelvVUcKUlWelk6i41CpM+iakWnqD+45tJAakIshZlQoIASn/DShugRUdF LIAYGi8BbC04s3E6k7lyzwqfRsRdZFZ2paJdd6c4ZESmWCoX17BK/JqQwnUGpLEz9e b6yfeo3A3vbGVPmkyqDkRZ6v9UTwjWYjn4t9p9uVQmW1sSiZEzZPXmsGTmsHHdhxaq 2hmIuC3PhRN+4c4XlFCh79d4evkN+67G1XPbt2USq4bhhs0V1sugylow7OFJb9XcSi gi/4JcPUzP61A== From: Arnd Bergmann To: Andrew Morton , Josh Poimboeuf , Peter Zijlstra Cc: Arnd Bergmann , Alexander Potapenko , Andrey Konovalov , Andrey Ryabinin , Dmitry Vyukov , Kuan-Ying Lee , Marco Elver , Vincenzo Frascino , kasan-dev@googlegroups.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] [v2] kmsan: disable ftrace in kmsan core code Date: Wed, 15 Feb 2023 14:00:57 +0100 Message-Id: <20230215130058.3836177-3-arnd@kernel.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230215130058.3836177-1-arnd@kernel.org> References: <20230215130058.3836177-1-arnd@kernel.org> MIME-Version: 1.0 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 7AC1C80031 X-Stat-Signature: ueredb1zxm9717qhcs3tbj8hfb7dhmf8 X-Rspam-User: X-HE-Tag: 1676466082-729874 X-HE-Meta: U2FsdGVkX18XZXxq6LEsYw69tjiU3yqA5nJBZCsudXVJLu1AVXeM6LC44OVEU5vTLIArw7y2mSadWC5oB2crhGqo+2p4wwuyimlc9WrdZY72EQ1WEjkFlneNNqzYL+DAB+AfSFerOXt2eMjhDRmPFvtWv9MiQRcK0BlDD3b5c2m7aq1yZf24wL4CUcYelJjgR+6O6MHW3GGjzUxzzKquuBexp253x95SGMCAzf71HxEdLWdCmrgKWIwAx1o/vyX/leHvKfEGpGLhLz6mqQaGZU0Pr4xSuuqxMpRi0EFQiUVfAwdsbuBXZ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YhBSUUBnUd7E4= 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: Arnd Bergmann objtool warns about some suspicous code inside of kmsan: vmlinux.o: warning: objtool: __msan_metadata_ptr_for_load_n+0x4: call to __fentry__() with UACCESS enabled vmlinux.o: warning: objtool: __msan_metadata_ptr_for_store_n+0x4: call to __fentry__() with UACCESS enabled vmlinux.o: warning: objtool: __msan_metadata_ptr_for_load_1+0x4: call to __fentry__() with UACCESS enabled vmlinux.o: warning: objtool: __msan_metadata_ptr_for_store_1+0x4: call to __fentry__() with UACCESS enabled vmlinux.o: warning: objtool: __msan_metadata_ptr_for_load_2+0x4: call to __fentry__() with UACCESS enabled vmlinux.o: warning: objtool: __msan_metadata_ptr_for_store_2+0x4: call to __fentry__() with UACCESS enabled vmlinux.o: warning: objtool: __msan_metadata_ptr_for_load_4+0x4: call to __fentry__() with UACCESS enabled vmlinux.o: warning: objtool: __msan_metadata_ptr_for_store_4+0x4: call to __fentry__() with UACCESS enabled vmlinux.o: warning: objtool: __msan_metadata_ptr_for_load_8+0x4: call to __fentry__() with UACCESS enabled vmlinux.o: warning: objtool: __msan_metadata_ptr_for_store_8+0x4: call to __fentry__() with UACCESS enabled vmlinux.o: warning: objtool: __msan_instrument_asm_store+0x4: call to __fentry__() with UACCESS enabled vmlinux.o: warning: objtool: __msan_chain_origin+0x4: call to __fentry__() with UACCESS enabled vmlinux.o: warning: objtool: __msan_poison_alloca+0x4: call to __fentry__() with UACCESS enabled vmlinux.o: warning: objtool: __msan_warning+0x4: call to __fentry__() with UACCESS enabled vmlinux.o: warning: objtool: __msan_get_context_state+0x4: call to __fentry__() with UACCESS enabled vmlinux.o: warning: objtool: kmsan_copy_to_user+0x4: call to __fentry__() with UACCESS enabled vmlinux.o: warning: objtool: kmsan_unpoison_memory+0x4: call to __fentry__() with UACCESS enabled vmlinux.o: warning: objtool: kmsan_unpoison_entry_regs+0x4: call to __fentry__() with UACCESS enabled vmlinux.o: warning: objtool: kmsan_report+0x4: call to __fentry__() with UACCESS enabled The Makefile contained a line to turn off ftrace for the entire directory, but this does not work. Replace it with individual lines, matching the approach in kasan. Fixes: f80be4571b19 ("kmsan: add KMSAN runtime core") Acked-by: Alexander Potapenko Signed-off-by: Arnd Bergmann --- v2: remove the old "CFLAGS_REMOVE.o = $(CC_FLAGS_FTRACE)" line --- mm/kmsan/Makefile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/mm/kmsan/Makefile b/mm/kmsan/Makefile index 98eab2856626..91cfdde642d1 100644 --- a/mm/kmsan/Makefile +++ b/mm/kmsan/Makefile @@ -14,7 +14,13 @@ CC_FLAGS_KMSAN_RUNTIME := -fno-stack-protector CC_FLAGS_KMSAN_RUNTIME += $(call cc-option,-fno-conserve-stack) CC_FLAGS_KMSAN_RUNTIME += -DDISABLE_BRANCH_PROFILING -CFLAGS_REMOVE.o = $(CC_FLAGS_FTRACE) +# Disable ftrace to avoid recursion. +CFLAGS_REMOVE_core.o = $(CC_FLAGS_FTRACE) +CFLAGS_REMOVE_hooks.o = $(CC_FLAGS_FTRACE) +CFLAGS_REMOVE_init.o = $(CC_FLAGS_FTRACE) +CFLAGS_REMOVE_instrumentation.o = $(CC_FLAGS_FTRACE) +CFLAGS_REMOVE_report.o = $(CC_FLAGS_FTRACE) +CFLAGS_REMOVE_shadow.o = $(CC_FLAGS_FTRACE) CFLAGS_core.o := $(CC_FLAGS_KMSAN_RUNTIME) CFLAGS_hooks.o := $(CC_FLAGS_KMSAN_RUNTIME) From patchwork Wed Feb 15 13:00:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 13141623 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 CDF94C6379F for ; Wed, 15 Feb 2023 13:01:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 29AFC6B0075; Wed, 15 Feb 2023 08:01:27 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2269C6B0078; Wed, 15 Feb 2023 08:01:27 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 02A966B007B; Wed, 15 Feb 2023 08:01:26 -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 DCD3D6B0075 for ; Wed, 15 Feb 2023 08:01:26 -0500 (EST) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 5FCDBC02EA for ; Wed, 15 Feb 2023 13:01:26 +0000 (UTC) X-FDA: 80469537372.25.4072EC1 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf16.hostedemail.com (Postfix) with ESMTP id 76BCE180008 for ; Wed, 15 Feb 2023 13:01:24 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=trjIqlwZ; spf=pass (imf16.hostedemail.com: domain of arnd@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=arnd@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1676466084; 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=TmXc5XX7mQ4tyyYhso+an7R7TS3SjE8ukS97BSt6G1c=; b=rX4k1DS5366sxHnXifrhtD+d4qtjL7oOL9zr3zDRfrdvrCP38Nb+afQmvkGYOJa18Iy9Zx wUf62MrOQlWig+8Vp/uMgWpAFXXIjfR6XXKCU0bXis75pVCpJHq56R1qrFlZ9RoVdEpdcv Ccl/OVeB0AG/EXgNDqEbdOhxY0LgU5o= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=trjIqlwZ; spf=pass (imf16.hostedemail.com: domain of arnd@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=arnd@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1676466084; a=rsa-sha256; cv=none; b=WaLWfkxmA1MVIqiB6lRTOm4s6Y+fX0GHM9mt0I1N+gg9Fw1jCJ2JS+7EC+K4xTzY6KZ9Jg cFfOy1Q/x4IorM7HjWsRfGvRAVe/Jmg9pKM7HgNmwnxvGvVsFGMX8Ttj2VWNqww3/GAoZ6 /UOKTifDzIN0gMkgNEse1Xj2eb4u94w= Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6E9BE61BA6; Wed, 15 Feb 2023 13:01:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4813DC433EF; Wed, 15 Feb 2023 13:01:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1676466083; bh=LCrzUXqbVxh67TyCMfdqY6tY7QeA2lgRgFNm/o1Clp0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=trjIqlwZyO+lwC6wY2BwIi2/mShc9WUDm9YrsjZ24D2fsCN/XdBERQW+gmteC8VNN YK4uldLchrzIGLzJ3nz93yG0XY7arZ3i4YgZ2Lc9Mu9lA7KxV1k4dey5CH+NCH8XPe T12gdgRSJvbK/HMFSkuKhQgI07jjONQ6YMov3TAIPRXlQM0Xh0TamEqo1+hkqCwWit A/HGHQ8tTFEqzT5Y7HhQ4ZkU+ePlRphqBw0io5rRVIm9/ye4Ja+OE3AAvycLdCH3OP m22aM8Hqp22iEmk+ci6F6qJRnjS2DdmigNWX2mZU7KKQzMWrXtKyApa/5ozRNmPlry yABFYRztl4azg== From: Arnd Bergmann To: Andrew Morton , Josh Poimboeuf , Peter Zijlstra Cc: Arnd Bergmann , Alexander Potapenko , Andrey Konovalov , Andrey Ryabinin , Dmitry Vyukov , Kuan-Ying Lee , Marco Elver , Vincenzo Frascino , kasan-dev@googlegroups.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/3] [v2] objtool: add UACCESS exceptions for __tsan_volatile_read/write Date: Wed, 15 Feb 2023 14:00:58 +0100 Message-Id: <20230215130058.3836177-4-arnd@kernel.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230215130058.3836177-1-arnd@kernel.org> References: <20230215130058.3836177-1-arnd@kernel.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: jtp9hga34gemxdkbb8sx9u93biaeqqk5 X-Rspamd-Queue-Id: 76BCE180008 X-HE-Tag: 1676466084-983281 X-HE-Meta: U2FsdGVkX19elBcsUePilIV91LtwzwvwXOT7ze33zicVWRuBVZ93D46EbeYLU5fWSsgU9rjypQR/HORRkcxcvhWUkeiUhdfW+siXOdu3t5UWa7EiRv4B15eQBozqAD+C67UNPCX2lEE39Y21Q8yd4krHxIzwgIcJsD5RpsNPvKjXnrK9UxWROKfLuOysI9GglCeeJjJnH/IoUKwd/dbla/lN84Le7ljt6MZF9oWx1U1y+WkMX05ho22Lt5rQKbSkfKnVHpE22TUgpw2+y//WnIa2mnFkDVwJxzkGGYgHdVum9Yl7EiXmmCtRko+aFNYSt8ty/Cit172pMzrofIE6QbUdvIBqsCQMrOigjkpcnVGY5tuLtXff4Jn9YeJjyZWBeFemV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ofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Arnd Bergmann A lot of the tsan helpers are already excempt from the UACCESS warnings, but some more functions were added that need the same thing: kernel/kcsan/core.o: warning: objtool: __tsan_volatile_read16+0x0: call to __tsan_unaligned_read16() with UACCESS enabled kernel/kcsan/core.o: warning: objtool: __tsan_volatile_write16+0x0: call to __tsan_unaligned_write16() with UACCESS enabled vmlinux.o: warning: objtool: __tsan_unaligned_volatile_read16+0x4: call to __tsan_unaligned_read16() with UACCESS enabled vmlinux.o: warning: objtool: __tsan_unaligned_volatile_write16+0x4: call to __tsan_unaligned_write16() with UACCESS enabled As Marco points out, these functions don't even call each other explicitly but instead gcc (but not clang) notices the functions being identical and turns one symbol into a direct branch to the other. Fixes: 75d75b7a4d54 ("kcsan: Support distinguishing volatile accesses") Acked-by: Marco Elver Signed-off-by: Arnd Bergmann --- tools/objtool/check.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/objtool/check.c b/tools/objtool/check.c index b0b467d9608a..da52ce861cc2 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -1237,6 +1237,8 @@ static const char *uaccess_safe_builtin[] = { "__tsan_atomic64_compare_exchange_val", "__tsan_atomic_thread_fence", "__tsan_atomic_signal_fence", + "__tsan_unaligned_read16", + "__tsan_unaligned_write16", /* KCOV */ "write_comp_data", "check_kcov_mode",