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: <CAADnVQLBtpsS_rkgoq7rOOXBzp4epAKy6PrObMdCUrvNkTJf2Q@mail.gmail.com>
Date: Wed, 24 Sep 2025 00:26:52 -0700
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
To: Andrea Righi <arighi@...dia.com>
Cc: Alexei Starovoitov <ast@...nel.org>, Daniel Borkmann <daniel@...earbox.net>, 
	Andrii Nakryiko <andrii@...nel.org>, Martin KaFai Lau <martin.lau@...ux.dev>, 
	Eduard Zingerman <eddyz87@...il.com>, Song Liu <song@...nel.org>, 
	Yonghong Song <yonghong.song@...ux.dev>, John Fastabend <john.fastabend@...il.com>, 
	KP Singh <kpsingh@...nel.org>, Stanislav Fomichev <sdf@...ichev.me>, Hao Luo <haoluo@...gle.com>, 
	Jiri Olsa <jolsa@...nel.org>, David Vernet <void@...ifault.com>, bpf <bpf@...r.kernel.org>, 
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] bpf: Mark kfuncs as __noclone

On Tue, Sep 23, 2025 at 11:33 PM Andrea Righi <arighi@...dia.com> wrote:
>
> On Fri, Aug 22, 2025 at 04:05:53PM +0200, Andrea Righi wrote:
> > Some distributions (e.g., CachyOS) support building the kernel with -O3,
> > but doing so may break kfuncs, resulting in their symbols not being
> > properly exported.
> >
> > In fact, with gcc -O3, some kfuncs may be optimized away despite being
> > annotated as noinline. This happens because gcc can still clone the
> > function during IPA optimizations, e.g., by duplicating or inlining it
> > into callers, and then dropping the standalone symbol. This breaks BTF
> > ID resolution since resolve_btfids relies on the presence of a global
> > symbol for each kfunc.
> >
> > Currently, this is not an issue for upstream, because we don't allow
> > building the kernel with -O3, but it may be safer to address it anyway,
> > to prevent potential issues in the future if compilers become more
> > aggressive with optimizations.
> >
> > Therefore, add __noclone to __bpf_kfunc to ensure kfuncs are never
> > cloned and remain distinct, globally visible symbols, regardless of
> > the optimization level.
> >
> > Fixes: 57e7c169cd6af ("bpf: Add __bpf_kfunc tag for marking kernel functions as kfuncs")
> > Signed-off-by: Andrea Righi <arighi@...dia.com>
>
> Gentle ping.
>
> Anyone has any concerns with this? Do you think we can apply it (so we
> don't have to keep carrying it out of tree)? :)

The patch expired in pw.
Pls resubmit with [PATCH bpf-next] subject.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ