From: Will Deacon <will@kernel.org>
To: Kees Cook <kees@kernel.org>
Cc: "Arnd Bergmann" <arnd@arndb.de>,
"Ard Biesheuvel" <ardb@kernel.org>,
"Catalin Marinas" <catalin.marinas@arm.com>,
"Jonathan Cameron" <Jonathan.Cameron@huawei.com>,
"Gavin Shan" <gshan@redhat.com>,
"Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>,
"James Morse" <james.morse@arm.com>,
"Oza Pawandeep" <quic_poza@quicinc.com>,
"Anshuman Khandual" <anshuman.khandual@arm.com>,
linux-arm-kernel@lists.infradead.org,
"Thomas Gleixner" <tglx@linutronix.de>,
"Ingo Molnar" <mingo@redhat.com>,
"Borislav Petkov" <bp@alien8.de>,
"Dave Hansen" <dave.hansen@linux.intel.com>,
"H. Peter Anvin" <hpa@zytor.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Mike Rapoport" <rppt@kernel.org>,
"Vitaly Kuznetsov" <vkuznets@redhat.com>,
"Henrique de Moraes Holschuh" <hmh@hmh.eng.br>,
"Hans de Goede" <hansg@kernel.org>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"Rafael J. Wysocki" <rafael@kernel.org>,
"Len Brown" <lenb@kernel.org>,
"Masami Hiramatsu" <mhiramat@kernel.org>,
"Michal Wilczynski" <michal.wilczynski@intel.com>,
"Juergen Gross" <jgross@suse.com>,
"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
"Kirill A. Shutemov" <kas@kernel.org>,
"Roger Pau Monne" <roger.pau@citrix.com>,
"David Woodhouse" <dwmw@amazon.co.uk>,
"Usama Arif" <usama.arif@bytedance.com>,
"Guilherme G. Piccoli" <gpiccoli@igalia.com>,
"Thomas Huth" <thuth@redhat.com>,
"Brian Gerst" <brgerst@gmail.com>,
"Marco Elver" <elver@google.com>,
"Andrey Konovalov" <andreyknvl@gmail.com>,
"Andrey Ryabinin" <ryabinin.a.a@gmail.com>,
"Hou Wenlong" <houwenlong.hwl@antgroup.com>,
"Andrew Morton" <akpm@linux-foundation.org>,
"Masahiro Yamada" <masahiroy@kernel.org>,
"Peter Zijlstra (Intel)" <peterz@infradead.org>,
"Luis Chamberlain" <mcgrof@kernel.org>,
"Sami Tolvanen" <samitolvanen@google.com>,
"Christophe Leroy" <christophe.leroy@csgroup.eu>,
"Nathan Chancellor" <nathan@kernel.org>,
"Nicolas Schier" <nicolas.schier@linux.dev>,
"Gustavo A. R. Silva" <gustavoars@kernel.org>,
"Andy Lutomirski" <luto@kernel.org>,
"Baoquan He" <bhe@redhat.com>, "Alexander Graf" <graf@amazon.com>,
"Changyuan Lyu" <changyuanl@google.com>,
"Paul Moore" <paul@paul-moore.com>,
"James Morris" <jmorris@namei.org>,
"Serge E. Hallyn" <serge@hallyn.com>,
"Nick Desaulniers" <nick.desaulniers+lkml@gmail.com>,
"Bill Wendling" <morbo@google.com>,
"Justin Stitt" <justinstitt@google.com>,
"Jan Beulich" <jbeulich@suse.com>,
"Boqun Feng" <boqun.feng@gmail.com>,
"Viresh Kumar" <viresh.kumar@linaro.org>,
"Paul E. McKenney" <paulmck@kernel.org>,
"Bibo Mao" <maobibo@loongson.cn>,
linux-kernel@vger.kernel.org, x86@kernel.org,
kvm@vger.kernel.org, ibm-acpi-devel@lists.sourceforge.net,
platform-driver-x86@vger.kernel.org, linux-acpi@vger.kernel.org,
linux-trace-kernel@vger.kernel.org, linux-efi@vger.kernel.org,
linux-mm@kvack.org, kasan-dev@googlegroups.com,
linux-kbuild@vger.kernel.org, linux-hardening@vger.kernel.org,
kexec@lists.infradead.org, linux-security-module@vger.kernel.org,
llvm@lists.linux.dev
Subject: Re: [PATCH v4 1/4] arm64: Handle KCOV __init vs inline mismatches
Date: Tue, 29 Jul 2025 09:10:55 +0100 [thread overview]
Message-ID: <aIiCD5V1MaI3ORqA@willie-the-truck> (raw)
In-Reply-To: <20250724055029.3623499-1-kees@kernel.org>
On Wed, Jul 23, 2025 at 10:50:25PM -0700, Kees Cook wrote:
> GCC appears to have kind of fragile inlining heuristics, in the
> sense that it can change whether or not it inlines something based on
> optimizations. It looks like the kcov instrumentation being added (or in
> this case, removed) from a function changes the optimization results,
> and some functions marked "inline" are _not_ inlined. In that case,
> we end up with __init code calling a function not marked __init, and we
> get the build warnings I'm trying to eliminate in the coming patch that
> adds __no_sanitize_coverage to __init functions:
>
> WARNING: modpost: vmlinux: section mismatch in reference: acpi_get_enable_method+0x1c (section: .text.unlikely) -> acpi_psci_present (section: .init.text)
>
> This problem is somewhat fragile (though using either __always_inline
> or __init will deterministically solve it), but we've tripped over
> this before with GCC and the solution has usually been to just use
> __always_inline and move on.
>
> For arm64 this requires forcing one ACPI function to be inlined with
> __always_inline.
>
> Signed-off-by: Kees Cook <kees@kernel.org>
> ---
> Cc: Will Deacon <will@kernel.org>
> Cc: Ard Biesheuvel <ardb@kernel.org>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: Gavin Shan <gshan@redhat.com>
> Cc: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
> Cc: James Morse <james.morse@arm.com>
> Cc: Oza Pawandeep <quic_poza@quicinc.com>
> Cc: Anshuman Khandual <anshuman.khandual@arm.com>
> Cc: <linux-arm-kernel@lists.infradead.org>
> ---
> arch/arm64/include/asm/acpi.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h
> index a407f9cd549e..c07a58b96329 100644
> --- a/arch/arm64/include/asm/acpi.h
> +++ b/arch/arm64/include/asm/acpi.h
> @@ -150,7 +150,7 @@ acpi_set_mailbox_entry(int cpu, struct acpi_madt_generic_interrupt *processor)
> {}
> #endif
>
> -static inline const char *acpi_get_enable_method(int cpu)
> +static __always_inline const char *acpi_get_enable_method(int cpu)
> {
> if (acpi_psci_present())
> return "psci";
Thanks for improving the commit message:
Acked-by: Will Deacon <will@kernel.org>
Will
next prev parent reply other threads:[~2025-07-29 8:11 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-24 5:50 [PATCH v4 0/4] stackleak: Support Clang stack depth tracking Kees Cook
2025-07-24 5:50 ` [PATCH v4 1/4] arm64: Handle KCOV __init vs inline mismatches Kees Cook
2025-07-29 8:10 ` Will Deacon [this message]
2025-07-24 5:50 ` [PATCH v4 2/4] x86: " Kees Cook
2025-07-29 8:28 ` Mike Rapoport
2025-07-29 9:34 ` Arnd Bergmann
2025-07-24 5:50 ` [PATCH v4 3/4] init.h: Disable sanitizer coverage for __init and __head Kees Cook
2025-07-24 5:50 ` [PATCH v4 4/4] kstack_erase: Support Clang stack depth tracking Kees Cook
2025-07-24 13:08 ` Nicolas Schier
2025-07-26 0:43 ` [PATCH v4 0/4] stackleak: " Nathan Chancellor
2025-07-26 6:27 ` Kees Cook
2025-07-26 21:47 ` Kees Cook
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aIiCD5V1MaI3ORqA@willie-the-truck \
--to=will@kernel.org \
--cc=Jonathan.Cameron@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=andreyknvl@gmail.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=anshuman.khandual@arm.com \
--cc=ardb@kernel.org \
--cc=arnd@arndb.de \
--cc=bhe@redhat.com \
--cc=boqun.feng@gmail.com \
--cc=bp@alien8.de \
--cc=brgerst@gmail.com \
--cc=catalin.marinas@arm.com \
--cc=changyuanl@google.com \
--cc=christophe.leroy@csgroup.eu \
--cc=dave.hansen@linux.intel.com \
--cc=dwmw@amazon.co.uk \
--cc=elver@google.com \
--cc=gpiccoli@igalia.com \
--cc=graf@amazon.com \
--cc=gshan@redhat.com \
--cc=gustavoars@kernel.org \
--cc=hansg@kernel.org \
--cc=hmh@hmh.eng.br \
--cc=houwenlong.hwl@antgroup.com \
--cc=hpa@zytor.com \
--cc=ibm-acpi-devel@lists.sourceforge.net \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=james.morse@arm.com \
--cc=jbeulich@suse.com \
--cc=jgross@suse.com \
--cc=jmorris@namei.org \
--cc=justinstitt@google.com \
--cc=kas@kernel.org \
--cc=kasan-dev@googlegroups.com \
--cc=kees@kernel.org \
--cc=kexec@lists.infradead.org \
--cc=kvm@vger.kernel.org \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-security-module@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=luto@kernel.org \
--cc=maobibo@loongson.cn \
--cc=masahiroy@kernel.org \
--cc=mcgrof@kernel.org \
--cc=mhiramat@kernel.org \
--cc=michal.wilczynski@intel.com \
--cc=mingo@redhat.com \
--cc=morbo@google.com \
--cc=nathan@kernel.org \
--cc=nick.desaulniers+lkml@gmail.com \
--cc=nicolas.schier@linux.dev \
--cc=paul@paul-moore.com \
--cc=paulmck@kernel.org \
--cc=pbonzini@redhat.com \
--cc=peterz@infradead.org \
--cc=platform-driver-x86@vger.kernel.org \
--cc=quic_poza@quicinc.com \
--cc=rafael@kernel.org \
--cc=rmk+kernel@armlinux.org.uk \
--cc=roger.pau@citrix.com \
--cc=rppt@kernel.org \
--cc=ryabinin.a.a@gmail.com \
--cc=samitolvanen@google.com \
--cc=serge@hallyn.com \
--cc=tglx@linutronix.de \
--cc=thuth@redhat.com \
--cc=usama.arif@bytedance.com \
--cc=viresh.kumar@linaro.org \
--cc=vkuznets@redhat.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox