From: Nathan Chancellor <nathan@kernel.org>
To: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Cc: Kees Cook <kees@kernel.org>,
Alexander Lobakin <aleksander.lobakin@intel.com>,
Simon Horman <horms@kernel.org>,
Nick Desaulniers <nick.desaulniers+lkml@gmail.com>,
Bill Wendling <morbo@google.com>,
Justin Stitt <justinstitt@google.com>,
Sami Tolvanen <samitolvanen@google.com>,
Russell King <linux@armlinux.org.uk>,
Tony Nguyen <anthony.l.nguyen@intel.com>,
Michal Kubiak <michal.kubiak@intel.com>,
linux-kernel@vger.kernel.org, llvm@lists.linux.dev,
linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org,
intel-wired-lan@lists.osuosl.org,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Subject: Re: [PATCH 3/3] libeth: xdp: Disable generic kCFI pass for libeth_xdp_tx_xmit_bulk()
Date: Mon, 27 Oct 2025 13:36:30 -0700 [thread overview]
Message-ID: <20251027203630.GA3183341@ax162> (raw)
In-Reply-To: <fa4487d0-a077-4582-80aa-2deeccee6270@intel.com>
Hi Przemek,
On Mon, Oct 27, 2025 at 12:09:47PM +0100, Przemek Kitszel wrote:
> sorry, but from regular driver developer perspective, just after reading
> your commit messages, I'm unable to tell what the fix is about, and from
> that follows a bigger issue: how to write code in the future to avoid
> such issues (it would be infeasible to always wait for a LLVM specialist
> to come up with a fix ;))
Sorry about that! To be fair, I am not sure most driver developers would
write something as subtle as this code to get themselves into a
situation where I or another LLVM person would need to come along to fix
it.
> was the tricky case to call __always_inline func from another that was
> marked the same? Would it be also the case if one of the functions would
> not be marked with __always_inline attribute, but still end up inlined?
No, I think the tricky case here is that the code depends on the
compiler being able to turn all these indirect calls, as the (*xmit)()
and (*prep)() parameters in libeth_xdp_tx_xmit_bulk(), into direct calls
through inlining. I find that depending on optimizations for correctness
(i.e., passing the assertion that the result of a equality test can be
proven true or false at compile time) is risky because it can result in
flexible but performant code but it is also sensitive to interactions
with other compiler internals and optimizations, resulting in changes
such as these.
> what would be the cost of the alternative naive solution, to always add
> __nocfi_generic to functions marked __always_inline?
> (technically you would redefine __always_inline to have also
> __nocfi_generic for the config combinations that require that)
No, you would not want to do this because if any indirect call remained
in the inlining chain, there would be no caller side CFI code generation
and that indirect call would automatically fail (if I understand
correctly), which is why commit 894af4a1cde6 ("objtool: Validate kCFI
calls") now validates this rule at compile time for x86_64 (which is not
affected by this issue since it does not use the generic LLVM kCFI pass
like ARM prior to 22.0.0 does).
> sorry for my ignorance of not reading any of the attached URLs
No worries, I am not sure how much more they would help with
understanding the problem, which is subtle. If I can clarify anything
further, please me know but I am not sure it will matter too much since
we will likely just forbid using the generic kCFI pass to avoid this
issue, rather than applying __nocfi_generic.
Cheers,
Nathan
next prev parent reply other threads:[~2025-10-27 20:36 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-25 20:53 [PATCH 0/3] Resolve ARM kCFI build failure in idpf xsk.c Nathan Chancellor
2025-10-25 20:53 ` [PATCH 1/3] compiler_types: Introduce __nocfi_generic Nathan Chancellor
2025-10-25 20:53 ` [PATCH 2/3] ARM: Select ARCH_USES_CFI_GENERIC_LLVM_PASS Nathan Chancellor
2025-10-27 15:53 ` Sami Tolvanen
2025-10-27 20:59 ` Nathan Chancellor
2025-10-27 22:56 ` Linus Walleij
2025-10-28 17:52 ` Nathan Chancellor
2025-10-28 18:14 ` Sami Tolvanen
2025-10-30 3:04 ` Kees Cook
2025-10-25 20:53 ` [PATCH 3/3] libeth: xdp: Disable generic kCFI pass for libeth_xdp_tx_xmit_bulk() Nathan Chancellor
2025-10-27 11:09 ` Przemek Kitszel
2025-10-27 20:36 ` Nathan Chancellor [this message]
2025-10-27 14:59 ` Alexander Lobakin
2025-10-27 20:54 ` Nathan Chancellor
2025-10-28 16:29 ` Alexander Lobakin
2025-10-28 22:01 ` Nathan Chancellor
2025-10-28 7:31 ` [Intel-wired-lan] " Loktionov, Aleksandr
2025-10-30 3:06 ` [PATCH 0/3] Resolve ARM kCFI build failure in idpf xsk.c 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=20251027203630.GA3183341@ax162 \
--to=nathan@kernel.org \
--cc=aleksander.lobakin@intel.com \
--cc=anthony.l.nguyen@intel.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=justinstitt@google.com \
--cc=kees@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=llvm@lists.linux.dev \
--cc=michal.kubiak@intel.com \
--cc=morbo@google.com \
--cc=netdev@vger.kernel.org \
--cc=nick.desaulniers+lkml@gmail.com \
--cc=pabeni@redhat.com \
--cc=przemyslaw.kitszel@intel.com \
--cc=samitolvanen@google.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;
as well as URLs for NNTP newsgroup(s).