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] [thread-next>] [day] [month] [year] [list]
Message-ID: <d91c8ccc-cf5f-4d50-9a8e-944f90e0401a@linux.dev>
Date: Wed, 26 Nov 2025 11:08:04 -0800
From: Ihor Solodrai <ihor.solodrai@...ux.dev>
To: bot+bpf-ci@...nel.org, ast@...nel.org, daniel@...earbox.net,
 andrii@...nel.org, martin.lau@...ux.dev, eddyz87@...il.com, song@...nel.org,
 yonghong.song@...ux.dev, john.fastabend@...il.com, kpsingh@...nel.org,
 sdf@...ichev.me, haoluo@...gle.com, jolsa@...nel.org, nathan@...nel.org,
 nicolas.schier@...ux.dev, nick.desaulniers+lkml@...il.com, morbo@...gle.com,
 justinstitt@...gle.com
Cc: bpf@...r.kernel.org, dwarves@...r.kernel.org,
 linux-kernel@...r.kernel.org, linux-kbuild@...r.kernel.org,
 alan.maguire@...cle.com, dolinux.peng@...il.com, martin.lau@...nel.org,
 clm@...a.com
Subject: Re: [PATCH bpf-next v1 3/4] resolve_btfids: introduce enum
 btf_id_kind

On 11/25/25 6:09 PM, bot+bpf-ci@...nel.org wrote:
>> diff --git a/tools/bpf/resolve_btfids/main.c b/tools/bpf/resolve_btfids/main.c
>> index b7b44e72e..7f5a9f7dd 100644
>> --- a/tools/bpf/resolve_btfids/main.c
>> +++ b/tools/bpf/resolve_btfids/main.c
> 
> [ ... ]
> 
>> @@ -260,26 +266,33 @@ static char *get_id(const char *prefix_end)
>>  	return id;
>>  }
>>
>> -static struct btf_id *add_set(struct object *obj, char *name, bool is_set8)
>> +static struct btf_id *add_set(struct object *obj, char *name, enum btf_id_kind kind)
>>  {
>>  	/*
>>  	 * __BTF_ID__set__name
>>  	 * name =    ^
>>  	 * id   =         ^
>>  	 */
>> -	char *id = name + (is_set8 ? sizeof(BTF_SET8 "__") : sizeof(BTF_SET "__")) - 1;
>> +	int prefixlen = kind == BTF_ID_KIND_SET8 ? sizeof(BTF_SET8 "__") : sizeof(BTF_SET "__");
>> +	char *id = name + prefixlen - 1;
>>  	int len = strlen(name);
>> +	struct btf_id *btf_id;
>>
>>  	if (id >= name + len) {
>>  		pr_err("FAILED to parse set name: %s\n", name);
>>  		return NULL;
>>  	}
>>
>> -	return btf_id__add(&obj->sets, id, true);
>> +	btf_id = btf_id__add(&obj->sets, id, true);
>> +	if (btf_id)
>> +		btf_id->kind = kind;
>> +
>> +	return btf_id;
>>  }
>>
>>  static struct btf_id *add_symbol(struct rb_root *root, char *name, size_t size)
>>  {
>> +	struct btf_id *btf_id;
>>  	char *id;
>>
>>  	id = get_id(name + size);
>> @@ -288,7 +301,10 @@ static struct btf_id *add_symbol(struct rb_root *root, char *name, size_t size)
>>  		return NULL;
>>  	}
>>
>> -	return btf_id__add(root, id, false);
>> +	btf_id = btf_id__add(root, id, false);
>> +	btf_id->kind = BTF_ID_KIND_SYM;
>                  ^^^^
> 
> Can add_symbol() dereference a NULL pointer here? The function
> btf_id__add() can return NULL on allocation failure (when zalloc fails),
> but the new code sets btf_id->kind before checking if btf_id is NULL.
> 
> In contrast, add_set() checks for NULL before setting the kind field.
> Should add_symbol() do the same?

We pass unique=false to btf_id__add() and that means that it can only
return NULL if zalloc() fails, which is unlikely.

Checking for NULL here is little too defensive, but won't hurt.

> 
>> +
>> +	return btf_id;
>>  }
> 
> [ ... ]
> 
> 
> ---
> AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
> See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md
> 
> CI run summary: https://github.com/kernel-patches/bpf/actions/runs/19689674924


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ