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: <3d0b94b9fdd5150c136784b5e6904264e5fb09a00d8512e459ec6c3046ed9abb@mail.kernel.org>
Date: Wed, 26 Nov 2025 02:09:40 +0000 (UTC)
From: bot+bpf-ci@...nel.org
To: ihor.solodrai@...ux.dev,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,ast@...nel.org,andrii@...nel.org,daniel@...earbox.net,martin.lau@...nel.org,eddyz87@...il.com,yonghong.song@...ux.dev,clm@...a.com,ihor.solodrai@...ux.dev
Subject: Re: [PATCH bpf-next v1 3/4] resolve_btfids: introduce enum btf_id_kind

> 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?

> +
> +	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