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+6O6MHW3GGjzUxzzKquuBexp253x95SGMC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8AApD6/99BAVAqPADpiCV7l7+Sj7C2QmXwlVjcV1vrmLRZA8JeB+7DdaxIh14obOcQVyqsrJiFJbU0RXLWpsgYhBSUUBnUd7E4= 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)