[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251014191330.GA899677@bhelgaas>
Date: Tue, 14 Oct 2025 14:13:30 -0500
From: Bjorn Helgaas <helgaas@...nel.org>
To: Nathan Chancellor <nathan@...nel.org>
Cc: Marek Vasut <marek.vasut+renesas@...il.com>,
Yoshihiro Shimoda <yoshihiro.shimoda.uh@...esas.com>,
Lorenzo Pieralisi <lpieralisi@...nel.org>,
Krzysztof WilczyĆski <kwilczynski@...nel.org>,
Manivannan Sadhasivam <mani@...nel.org>,
Rob Herring <robh@...nel.org>, Bjorn Helgaas <bhelgaas@...gle.com>,
Geert Uytterhoeven <geert+renesas@...der.be>,
Magnus Damm <magnus.damm@...il.com>, Kees Cook <kees@...nel.org>,
Peter Zijlstra <peterz@...radead.org>, linux-pci@...r.kernel.org,
linux-renesas-soc@...r.kernel.org, linux-kernel@...r.kernel.org,
llvm@...ts.linux.dev, kernel test robot <lkp@...el.com>
Subject: Re: [PATCH v2] PCI: rcar-host: Add OF Kconfig dependency to avoid
objtool no-cfi warning
On Tue, Oct 14, 2025 at 11:20:27AM -0700, Nathan Chancellor wrote:
> After commit 894af4a1cde6 ("objtool: Validate kCFI calls"), compile
> testing pcie-rcar-host.c with CONFIG_FINEIBT=y and CONFIG_OF=n results
> in a no-cfi objtool warning in rcar_pcie_probe():
>
> $ cat allno.config
> CONFIG_CFI=y
> CONFIG_COMPILE_TEST=y
> CONFIG_CPU_MITIGATIONS=y
> CONFIG_GENERIC_PHY=y
> CONFIG_MITIGATION_RETPOLINE=y
> CONFIG_MODULES=y
> CONFIG_PCI=y
> CONFIG_PCI_MSI=y
> CONFIG_PCIE_RCAR_HOST=y
> CONFIG_X86_KERNEL_IBT=y
>
> $ make -skj"$(nproc)" ARCH=x86_64 KCONFIG_ALLCONFIG=1 LLVM=1 clean allnoconfig vmlinux
> vmlinux.o: warning: objtool: rcar_pcie_probe+0x191: no-cfi indirect call!
>
> When CONFIG_OF is unset, of_device_get_match_data() returns NULL, so
> LLVM knows this indirect call has no valid destination and drops the
> kCFI setup before the call, triggering the objtool check that makes sure
> all indirect calls have kCFI setup.
>
> This driver depends on OF for probing with non-NULL data for every match
> so this call will never be NULL in practice. Add a hard Kconfig
> dependency on OF to avoid the warning.
>
> Reported-by: kernel test robot <lkp@...el.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202510092124.O2IX0Jek-lkp@intel.com/
> Closes: https://github.com/ClangBuiltLinux/linux/issues/2134
> Signed-off-by: Nathan Chancellor <nathan@...nel.org>
> ---
> Changes in v2:
> - Switch from NULL check to avoiding CONFIG_OF=n case altogether (Mani,
> Geert).
> - Drop Peter and Kees's reviews, as solution is not the same.
> - Link to v1: https://patch.msgid.link/20251013-rcar_pcie_probe-avoid-nocfi-objtool-warning-v1-1-552876b94f04@kernel.org
> ---
> drivers/pci/controller/Kconfig | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/pci/controller/Kconfig b/drivers/pci/controller/Kconfig
> index 41748d083b93..d8688abc5b27 100644
> --- a/drivers/pci/controller/Kconfig
> +++ b/drivers/pci/controller/Kconfig
> @@ -243,6 +243,7 @@ config PCI_TEGRA
> config PCIE_RCAR_HOST
> bool "Renesas R-Car PCIe controller (host mode)"
> depends on ARCH_RENESAS || COMPILE_TEST
> + depends on OF
Ugh. This might be the best solution, but it's a bit problematic
without a hint about why "depends on OF" is here. Theoretically there
are stubs for everything to make COMPILE_TEST work, so I think we're
about to drop all the dependencies on OF.
This dependency to avoid a no-cfi warning looks like the kind of thing
that could someday go away if the tools get smarter. Maybe we can add
a Kconfig comment here, but I don't really know enough to write one.
Something like this?
depends on OF # avoid no-cfi warning https://lore.kernel.org/r/202510092124.O2IX0Jek-lkp@intel.com/
Powered by blists - more mailing lists