On Wed, 2024-08-28 at 22:45 -0700, Eduard Zingerman wrote: [...] > I will prepare a test case. > Probably tomorrow. Please find test in the attachment. This test triggers KASAN error report as in another attachment. (I enabled CONFIG_KASAN using menuconfig on top of regular selftest config). On Fri, Aug 23, 2024 at 3:43 AM Jeongjun Park wrote: [...] > diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c > index 520f49f422fe..5c24ea1a65a4 100644 > --- a/kernel/bpf/btf.c > +++ b/kernel/bpf/btf.c > @@ -823,6 +823,9 @@ static bool btf_name_valid_section(const struct btf *btf, u32 offset) > const char *src = btf_str_by_offset(btf, offset); > const char *src_limit; > > + if (!*src) > + return false; > + I think that correct fix would be as follows: --- diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c index edad152cee8e..d583d76fcace 100644 --- a/kernel/bpf/btf.c +++ b/kernel/bpf/btf.c @@ -820,7 +820,6 @@ static bool btf_name_valid_section(const struct btf *btf, u32 offset) /* set a limit on identifier length */ src_limit = src + KSYM_NAME_LEN; - src++; while (*src && src < src_limit) { if (!isprint(*src)) return false;