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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c29c91ad68f01b8bee8fff36b511d4dbdca1549d.camel@gmail.com>
Date: Mon, 24 Nov 2025 10:20:55 -0800
From: Eduard Zingerman <eddyz87@...il.com>
To: Donglin Peng <dolinux.peng@...il.com>
Cc: Andrii Nakryiko <andrii.nakryiko@...il.com>, ast@...nel.org, 
	zhangxiaoqin@...omi.com, linux-kernel@...r.kernel.org, bpf@...r.kernel.org,
  Donglin Peng <pengdonglin@...omi.com>, Alan Maguire
 <alan.maguire@...cle.com>, Song Liu <song@...nel.org>
Subject: Re: [RFC PATCH v7 5/7] libbpf: Implement BTF type sorting
 validation for binary search optimization

On Sat, 2025-11-22 at 16:38 +0800, Donglin Peng wrote:
> On Sat, Nov 22, 2025 at 3:32 PM Donglin Peng <dolinux.peng@...il.com> wrote:
> > 
> > On Sat, Nov 22, 2025 at 3:42 AM Eduard Zingerman <eddyz87@...il.com> wrote:
> > > 
> > > On Thu, 2025-11-20 at 15:25 +0800, Donglin Peng wrote:
> > > 
> > > [...]
> > > 
> > > > Additionally, in the linear search branch, I saw there is a NULL check for
> > > > the name returned by btf__name_by_offset. This suggests that checking
> > > > name_off == 0 alone may not be sufficient to identify an anonymous type,
> > > > which is why I used str_is_empty for a more robust check.
> > > 
> > > btf_str_by_offset(btf, offset) returns NULL only when 'offset' is
> > > larger then 'btf->hdr.str_len'. However, function btf_check_meta()
> > > verifies that this shall not happen by invoking
> > > btf_name_offset_valid() check. The btf_check_meta() is invoked for all
> > > types by btf_check_all_metas() called from btf_parse_base(),
> > > btf_parse_module() and btf_parse_type_sec() -> btf_parse().
> > > 
> > > So, it appears that kernel protects itself from invalid name_off
> > > values at BTF load time.
> > 
> > Right. The kernel guarantees that btf_str_by_offsetnever returns NULL,
> > and there is no NULL check performed on the name returned by
> > btf_find_by_name_kind. The NULL check is included in the libbpf version
> > of the function.
> 
> Sorry — my mistake. There’s no NULL check on the name from
> btf_str_by_offset in the kernel’s btf_find_by_name_kind. The
> libbpf version has it.

tools/lib/bpf/btf.c:btf_sanity_check() is called from btf_new(),
it calls btf_validate_type(), which does btf_validate_str().
So, ignoring the NULL case on libbpf side should be safe as well.

[...]

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ