From: Nathan Chancellor <nathan@kernel.org>
To: Peter Zijlstra <peterz@infradead.org>,
Bjorn Helgaas <helgaas@kernel.org>
Cc: Marek Vasut <marek.vasut+renesas@gmail.com>,
Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>,
Lorenzo Pieralisi <lpieralisi@kernel.org>,
Krzysztof Wilczy??ski <kwilczynski@kernel.org>,
Manivannan Sadhasivam <mani@kernel.org>,
Rob Herring <robh@kernel.org>,
Bjorn Helgaas <bhelgaas@google.com>,
Geert Uytterhoeven <geert+renesas@glider.be>,
Magnus Damm <magnus.damm@gmail.com>, Kees Cook <kees@kernel.org>,
linux-pci@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
linux-kernel@vger.kernel.org, llvm@lists.linux.dev,
kernel test robot <lkp@intel.com>
Subject: Re: [PATCH v2] PCI: rcar-host: Add OF Kconfig dependency to avoid objtool no-cfi warning
Date: Tue, 14 Oct 2025 15:25:24 -0700 [thread overview]
Message-ID: <20251014222524.GA3575477@ax162> (raw)
In-Reply-To: <20251014194728.GD1206438@noisy.programming.kicks-ass.net>
On Tue, Oct 14, 2025 at 09:47:28PM +0200, Peter Zijlstra wrote:
> On Tue, Oct 14, 2025 at 02:13:30PM -0500, Bjorn Helgaas wrote:
>
> > 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.
>
> Its those stubs are exactly the problem.
Yeah and I had thought about changing of_device_get_match_data() to use
something like ERR_PTR() in the !OF case but that does not fix the issue
since the call destination is still going to be invalid. To me, this is
just one of the sharp edges of compile testing: you give up some code or
configuration cleanliness/expectations for the flexibility of build
testing.
> > 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?
>
> Its not a CFI warning per-se, the compiler is hitting known UB
> (unconditional NULL deref) and is currently emitting a NULL pointer
> indirect call, but given how aggressive clang has been on encountering
> UB it might just stop code-gen entirely and generate fall-through
> warnings (been there done that).
>
> Smarter compiler here is only going to make this worse.
Yeah, we are lucky that this is all LLVM does with this code.
For what it's worth, there is plenty of "depends on OF" that appears
across the tree and I see exactly one instance that has a comment above
it (none with the comment on the same line). Perhaps these are all
historical if there was a point where stubs were not provided for !OF. I
do not mind adding a comment if really so desired but this driver does
not do anything without CONFIG_OF so it feels like the dependency is
natural anyways.
Cheers,
Nathan
next prev parent reply other threads:[~2025-10-14 22:25 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-14 18:20 [PATCH v2] PCI: rcar-host: Add OF Kconfig dependency to avoid objtool no-cfi warning Nathan Chancellor
2025-10-14 19:13 ` Bjorn Helgaas
2025-10-14 19:47 ` Peter Zijlstra
2025-10-14 22:25 ` Nathan Chancellor [this message]
2025-10-27 12:26 ` Manivannan Sadhasivam
2025-12-18 5:23 ` Manivannan Sadhasivam
2025-12-26 23:46 ` Bjorn Helgaas
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=20251014222524.GA3575477@ax162 \
--to=nathan@kernel.org \
--cc=bhelgaas@google.com \
--cc=geert+renesas@glider.be \
--cc=helgaas@kernel.org \
--cc=kees@kernel.org \
--cc=kwilczynski@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=lkp@intel.com \
--cc=llvm@lists.linux.dev \
--cc=lpieralisi@kernel.org \
--cc=magnus.damm@gmail.com \
--cc=mani@kernel.org \
--cc=marek.vasut+renesas@gmail.com \
--cc=peterz@infradead.org \
--cc=robh@kernel.org \
--cc=yoshihiro.shimoda.uh@renesas.com \
/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