lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <IA3PR11MB89868B14FC6C35C589325FEFE5FDA@IA3PR11MB8986.namprd11.prod.outlook.com>
Date: Tue, 28 Oct 2025 07:31:26 +0000
From: "Loktionov, Aleksandr" <aleksandr.loktionov@...el.com>
To: Nathan Chancellor <nathan@...nel.org>, Kees Cook <kees@...nel.org>,
	"Lobakin, Aleksander" <aleksander.lobakin@...el.com>, "David S. Miller"
	<davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski
	<kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>
CC: Simon Horman <horms@...nel.org>, Nick Desaulniers
	<nick.desaulniers+lkml@...il.com>, Bill Wendling <morbo@...gle.com>, "Justin
 Stitt" <justinstitt@...gle.com>, Sami Tolvanen <samitolvanen@...gle.com>,
	Russell King <linux@...linux.org.uk>, "Nguyen, Anthony L"
	<anthony.l.nguyen@...el.com>, Michal Kubiak <michal.kubiak@...el.com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"llvm@...ts.linux.dev" <llvm@...ts.linux.dev>,
	"linux-arm-kernel@...ts.infradead.org"
	<linux-arm-kernel@...ts.infradead.org>, "netdev@...r.kernel.org"
	<netdev@...r.kernel.org>, "intel-wired-lan@...ts.osuosl.org"
	<intel-wired-lan@...ts.osuosl.org>
Subject: RE: [Intel-wired-lan] [PATCH 3/3] libeth: xdp: Disable generic kCFI
 pass for libeth_xdp_tx_xmit_bulk()



> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@...osl.org> On Behalf
> Of Nathan Chancellor
> Sent: Saturday, October 25, 2025 10:53 PM
> To: Kees Cook <kees@...nel.org>; Lobakin, Aleksander
> <aleksander.lobakin@...el.com>; David S. Miller <davem@...emloft.net>;
> Eric Dumazet <edumazet@...gle.com>; Jakub Kicinski <kuba@...nel.org>;
> Paolo Abeni <pabeni@...hat.com>
> Cc: Simon Horman <horms@...nel.org>; Nathan Chancellor
> <nathan@...nel.org>; Nick Desaulniers
> <nick.desaulniers+lkml@...il.com>; Bill Wendling <morbo@...gle.com>;
> Justin Stitt <justinstitt@...gle.com>; Sami Tolvanen
> <samitolvanen@...gle.com>; Russell King <linux@...linux.org.uk>;
> Nguyen, Anthony L <anthony.l.nguyen@...el.com>; Michal Kubiak
> <michal.kubiak@...el.com>; linux-kernel@...r.kernel.org;
> llvm@...ts.linux.dev; linux-arm-kernel@...ts.infradead.org;
> netdev@...r.kernel.org; intel-wired-lan@...ts.osuosl.org
> Subject: [Intel-wired-lan] [PATCH 3/3] libeth: xdp: Disable generic
> kCFI pass for libeth_xdp_tx_xmit_bulk()
> 
> When building drivers/net/ethernet/intel/idpf/xsk.c for ARCH=arm with
> CONFIG_CFI=y using a version of LLVM prior to 22.0.0, there is a
> BUILD_BUG_ON failure:
> 
>   $ cat arch/arm/configs/repro.config
>   CONFIG_BPF_SYSCALL=y
>   CONFIG_CFI=y
>   CONFIG_IDPF=y
>   CONFIG_XDP_SOCKETS=y
> 
>   $ make -skj"$(nproc)" ARCH=arm LLVM=1 clean defconfig repro.config
> drivers/net/ethernet/intel/idpf/xsk.o
>   In file included from drivers/net/ethernet/intel/idpf/xsk.c:4:
>   include/net/libeth/xsk.h:205:2: error: call to
> '__compiletime_assert_728' declared with 'error' attribute:
> BUILD_BUG_ON failed: !__builtin_constant_p(tmo == libeth_xsktmo)
>     205 |         BUILD_BUG_ON(!__builtin_constant_p(tmo ==
> libeth_xsktmo));
>         |         ^
>   ...
> 
> libeth_xdp_tx_xmit_bulk() indirectly calls libeth_xsk_xmit_fill_buf()
> but these functions are marked as __always_inline so that the compiler
> can turn these indirect calls into direct ones and see that the tmo
> parameter to __libeth_xsk_xmit_fill_buf_md() is ultimately
> libeth_xsktmo from idpf_xsk_xmit().
> 
> Unfortunately, the generic kCFI pass in LLVM expands the kCFI bundles
> from the indirect calls in libeth_xdp_tx_xmit_bulk() in such a way
> that later optimizations cannot turn these calls into direct ones,
> making the BUILD_BUG_ON fail because it cannot be proved at compile
> time that tmo is libeth_xsktmo.
> 
> Disable the generic kCFI pass for libeth_xdp_tx_xmit_bulk() to ensure
> these indirect calls can always be turned into direct calls to avoid
> this error.
> 
> Closes: https://github.com/ClangBuiltLinux/linux/issues/2124
> Fixes: 9705d6552f58 ("idpf: implement Rx path for AF_XDP")
> Signed-off-by: Nathan Chancellor <nathan@...nel.org>
> ---
>  include/net/libeth/xdp.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/net/libeth/xdp.h b/include/net/libeth/xdp.h index
> bc3507edd589..898723ab62e8 100644
> --- a/include/net/libeth/xdp.h
> +++ b/include/net/libeth/xdp.h
> @@ -513,7 +513,7 @@ struct libeth_xdp_tx_desc {
>   * can't fail, but can send less frames if there's no enough free
> descriptors
>   * available. The actual free space is returned by @prep from the
> driver.
>   */
> -static __always_inline u32
> +static __always_inline __nocfi_generic u32
>  libeth_xdp_tx_xmit_bulk(const struct libeth_xdp_tx_frame *bulk, void
> *xdpsq,
>  			u32 n, bool unroll, u64 priv,
>  			u32 (*prep)(void *xdpsq, struct libeth_xdpsq
> *sq),
> 
> --
> 2.51.1

Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@...el.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ