[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5a8c765f8e2b4473d9833d468ea43ad8ea7e57b6.camel@gmail.com>
Date: Fri, 07 Nov 2025 10:58:27 -0800
From: Eduard Zingerman <eddyz87@...il.com>
To: Alexei Starovoitov <alexei.starovoitov@...il.com>
Cc: Donglin Peng <dolinux.peng@...il.com>, bot+bpf-ci@...nel.org, Alexei
Starovoitov <ast@...nel.org>, Andrii Nakryiko <andrii.nakryiko@...il.com>,
zhangxiaoqin@...omi.com, LKML <linux-kernel@...r.kernel.org>, bpf
<bpf@...r.kernel.org>, Alan Maguire <alan.maguire@...cle.com>, Song Liu
<song@...nel.org>, pengdonglin <pengdonglin@...omi.com>, Andrii Nakryiko
<andrii@...nel.org>, Daniel Borkmann <daniel@...earbox.net>, Martin KaFai
Lau <martin.lau@...nel.org>, Yonghong Song <yonghong.song@...ux.dev>,
Chris Mason <clm@...a.com>, Ihor Solodrai <ihor.solodrai@...ux.dev>
Subject: Re: [PATCH v5 6/7] btf: Add lazy sorting validation for binary
search
On Fri, 2025-11-07 at 10:54 -0800, Alexei Starovoitov wrote:
[...]
> > > > > @@ -610,7 +674,7 @@ s32 btf_find_by_name_kind(const struct
> > > > > btf
> > > > > *btf, const char *name, u8 kind)
> > > > > goto out;
> > > > > }
> > > > >
> > > > > - if (btf->nr_sorted_types != BTF_NEED_SORT_CHECK) {
> > > > > + if (btf_check_sorted((struct btf *)btf)) {
> > > > ^
> > > >
> > > > The const cast here enables the concurrent writes discussed
> > > > above.
> > > > Is
> > > > there a reason to mark the btf parameter as const if we're
> > > > modifying it?
> > >
> > > Hi team, is casting away const an acceptable approach for our
> > > codebase?
> >
> > Casting away const is undefined behaviour, e.g. see paragraph
> > 6.7.3.6
> > N1570 ISO/IEC 9899:201x Programming languages — C.
> >
> > Both of the problems above can be avoided if kernel will do sorted
> > check non-lazily. But Andrii and Alexei seem to like that property.
>
> Ihor is going to move BTF manipulations into resolve_btfid.
> Sorting of BTF should be in resolve_btfid as well.
> This way the build process will guarantee that BTF is sorted
> to the kernel liking. So the kernel doesn't even need to check
> that BTF is sorted.
This would be great.
Does this imply that module BTFs are sorted too?
Powered by blists - more mailing lists