From mboxrd@z Thu Jan 1 00:00:00 1970 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 097C5C87FCD for ; Thu, 24 Jul 2025 09:02:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-Id:Date :Subject:To:From:Reply-To:Content-Type:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=C8D4LxVY5xiBAnCpq4qjYfypcmK3R7vRmG4YyK+yYkI=; b=K6SLriTgdKfibV JdtXppBt0KHBlXWj0SyupepxO9ctEcH2Ywaa5EO2TkXIDx/wTJKzwF8TFut5cTuXt8nXI4HwtyroG W0RVnSMfFg0WvtBdljfRtdeOvJGYFalKdO/otl4Yt0CYDREWICfYoTCeAFVSIuDrJRao3I5i0R2gp bQvt4XMdjp4XvX9W5Idiq1ZEtWy4PNv9C62iX+WYgWjCbvQfmLjHvIFBHZCP6nTdhvltRNHZXXaEI sIv1GB/8zTXqf0/+X9tHYAOpsN9yv0a1C5ibJTkbmKLtCoDxL2FdgxXpLwFZwCxvspVelRH3wqzzR j4DgAhZD4TTuS1jzEhLw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1uerqi-00000006yaF-3Fej; Thu, 24 Jul 2025 09:02:48 +0000 Received: from sea.source.kernel.org ([172.234.252.31]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1ueoqe-00000006Y0X-3v5I; Thu, 24 Jul 2025 05:50:36 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id 1CC7146586; Thu, 24 Jul 2025 05:50:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9D569C2BCB0; Thu, 24 Jul 2025 05:50:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1753336230; bh=9V+bffTinVGVEjmw6TF+C5G0YfQpy53YZa3Wm2q7aj4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ooTp5DYalG+7sCY7UY80o0GaKZMJuJsxJyjGuabcQLgPm5nuSMqxAePrfT7GjvhdK oF9fORgAmBuhwOhWaT/I1eVzeHaxvCjNnvP3mFcCVtrohHTelgnJB8AxJRHMej+Mg4 NFDjdV1sYJAqwLAHAKG+Pc7P7tPoem5TaSnEds9YldJcU6sAmB42ruRa5SIZpDw1hv cKr4I8Z7LDvwzyqdEhc2lYfeETzrrTMLlCXC7ApBabnc8CBhH419Ml2t43642mwJKw GdpLf5pCI2siQYBJvR4jNh/zgf/ZyAdgBMjqYlW1WxwimCTLeg3bNom27bS+51Pyca 3cu5ZswAR3k0w== From: Kees Cook To: Arnd Bergmann Subject: [PATCH v4 3/4] init.h: Disable sanitizer coverage for __init and __head Date: Wed, 23 Jul 2025 22:50:27 -0700 Message-Id: <20250724055029.3623499-3-kees@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250724054419.it.405-kees@kernel.org> References: <20250724054419.it.405-kees@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2887; i=kees@kernel.org; h=from:subject; bh=9V+bffTinVGVEjmw6TF+C5G0YfQpy53YZa3Wm2q7aj4=; b=owGbwMvMwCVmps19z/KJym7G02pJDBmNJxdz3tX005Y/rnL4YOLkChWuJ+9Wl0ZxtHAnf5w+4 +zlC8f3dZSyMIhxMciKKbIE2bnHuXi8bQ93n6sIM4eVCWQIAxenAEzkYR0jQ3OLrmDdCpsGS/2v XwqtbKYZz2RJ7Lh0a141x9MPJVGnpzIydBStU54v9Wp98GqlzKdyYSda/YzleKsypsy4O3tZzgI uBgA= X-Developer-Key: i=kees@kernel.org; a=openpgp; fpr=A5C3F68F229DD60F723E6E138972F4DFDC6DC026 Content-Transfer-Encoding: 8bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250723_225033_053123_FFCFFEF1 X-CRM114-Status: GOOD ( 15.74 ) X-Mailman-Approved-At: Thu, 24 Jul 2025 01:12:22 -0700 X-BeenThere: kexec@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Kirill A. Shutemov" , linux-efi@vger.kernel.org, Gavin Shan , Jan Beulich , kvm@vger.kernel.org, "Rafael J. Wysocki" , Kees Cook , Catalin Marinas , Dave Hansen , llvm@lists.linux.dev, Michal Wilczynski , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Usama Arif , Andrey Ryabinin , Viresh Kumar , kasan-dev@googlegroups.com, Henrique de Moraes Holschuh , "H. Peter Anvin" , Will Deacon , Ard Biesheuvel , linux-trace-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, Hans de Goede , Baoquan He , linux-acpi@vger.kernel.org, Masahiro Yamada , x86@kernel.org, James Morris , Christophe Leroy , "Peter Zijlstra \(Intel\)" , Ingo Molnar , Oza Pawandeep , Sami Tolvanen , Changyuan Lyu , Thomas Huth , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Hou Wenlong , Nick Desaulniers , Len Brown , platform-driver-x86@vger.kernel.org, Marco Elver , Alexander Graf , "Paul E. McKenney" , Anshuman Khandual , Brian Gerst , Boqun Feng , Masami Hiramatsu , Bibo Mao , Nathan Chancellor , Paul Moore , "Russell King \(Oracle\)" , Borislav Petkov , Andy Lutomirski , Jonathan Cameron , Thomas Gleixner , Andy Shevchenko , linux-hardening@vger.kernel.org, Vitaly Kuznetsov , linux-arm-kernel@lists.infradead.org, Andrey Konovalov , Juergen Gross , Nicolas Schier , ibm-acpi-devel@lists.sourceforge.net, kexec@lists.infradead.org, "Gustavo A. R. Silva" , linux-kbuild@vger.kernel.org, Luis Chamberlain , James Morse , Mike Rapoport , Justin Stitt , Paolo Bonzini , Andrew Morton , "Serge E. Hallyn" , Bill Wendling , David Woodhouse , "Kirill A. Shutemov" , Roger Pau Monne Sender: "kexec" Errors-To: kexec-bounces+kexec=archiver.kernel.org@lists.infradead.org While __noinstr already contained __no_sanitize_coverage, it needs to be added to __init and __head section markings to support the Clang implementation of CONFIG_KSTACK_ERASE. This is to make sure the stack depth tracking callback is not executed in unsupported contexts. The other sanitizer coverage options (trace-pc and trace-cmp) aren't needed in __head nor __init either ("We are interested in code coverage as a function of a syscall inputs"[1]), so this is fine to disable for them as well. Link: https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/kernel/kcov.c?h=v6.14#n179 [1] Acked-by: Marco Elver Signed-off-by: Kees Cook --- Cc: Marco Elver Cc: Andrey Konovalov Cc: Andrey Ryabinin Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: Dave Hansen Cc: Cc: "H. Peter Anvin" Cc: Ard Biesheuvel Cc: "Kirill A. Shutemov" Cc: Hou Wenlong Cc: Andrew Morton Cc: Masahiro Yamada Cc: "Peter Zijlstra (Intel)" Cc: Luis Chamberlain Cc: Sami Tolvanen Cc: Arnd Bergmann Cc: Christophe Leroy Cc: --- arch/x86/include/asm/init.h | 2 +- include/linux/init.h | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/init.h b/arch/x86/include/asm/init.h index 8b1b1abcef15..6bfdaeddbae8 100644 --- a/arch/x86/include/asm/init.h +++ b/arch/x86/include/asm/init.h @@ -5,7 +5,7 @@ #if defined(CONFIG_CC_IS_CLANG) && CONFIG_CLANG_VERSION < 170000 #define __head __section(".head.text") __no_sanitize_undefined __no_stack_protector #else -#define __head __section(".head.text") __no_sanitize_undefined +#define __head __section(".head.text") __no_sanitize_undefined __no_sanitize_coverage #endif struct x86_mapping_info { diff --git a/include/linux/init.h b/include/linux/init.h index ee1309473bc6..c65a050d52a7 100644 --- a/include/linux/init.h +++ b/include/linux/init.h @@ -49,7 +49,9 @@ /* These are for everybody (although not all archs will actually discard it in modules) */ -#define __init __section(".init.text") __cold __latent_entropy __noinitretpoline +#define __init __section(".init.text") __cold __latent_entropy \ + __noinitretpoline \ + __no_sanitize_coverage #define __initdata __section(".init.data") #define __initconst __section(".init.rodata") #define __exitdata __section(".exit.data") -- 2.34.1