Skip to content

objtool: rcar_pcie_probe+0x191: no-cfi indirect call! #2134

@nathanchance

Description

@nathanchance

Originally reported at https://lore.kernel.org/[email protected]/

With 6.18-rc1 and at least LLVM 21.1.3:

$ 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!

As Peter and I already triaged, without CONFIG_OF, of_device_get_match_data() always calls NULL so host->phy_init_fn(host) will always be a crash, so LLVM drops the CFI metadata, which angers objtool's new __nocfi check.

diff --git a/drivers/pci/controller/pcie-rcar-host.c b/drivers/pci/controller/pcie-rcar-host.c
index 213028052aa5..15514c9c1927 100644
--- a/drivers/pci/controller/pcie-rcar-host.c
+++ b/drivers/pci/controller/pcie-rcar-host.c
@@ -981,7 +981,7 @@ static int rcar_pcie_probe(struct platform_device *pdev)
 		goto err_clk_disable;
 
 	host->phy_init_fn = of_device_get_match_data(dev);
-	err = host->phy_init_fn(host);
+	err = host->phy_init_fn ? host->phy_init_fn(host) : -ENODEV;
 	if (err) {
 		dev_err(dev, "failed to init PCIe PHY\n");
 		goto err_clk_disable;

Metadata

Metadata

Assignees

Labels

[ARCH] x86_64This bug impacts ARCH=x86_64[FEATURE] CFIRelated to building the kernel with Clang Control Flow Integrity[PATCH] AcceptedA submitted patch has been accepted upstream[TOOL] objtoolwarning is produced by the kernel's objtool

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions