From: Dan Carpenter <error27@gmail.com>
To: Amery Hung <ameryhung@gmail.com>
Cc: bpf@vger.kernel.org
Subject: [bug report] bpf: Refactor object relationship tracking and fix dynptr UAF bug
Date: Mon, 8 Jun 2026 17:55:40 +0300 [thread overview]
Message-ID: <aibX7BzvtbZYoZcY@stanley.mountain> (raw)
Hello Amery Hung,
Commit 308c7a0ae885 ("bpf: Refactor object relationship tracking and
fix dynptr UAF bug") from May 28, 2026 (linux-next), leads to the
following Smatch static checker warning:
kernel/bpf/verifier.c:13115 check_kfunc_call()
warn: error code type promoted to positive: 'id'
kernel/bpf/verifier.c
12810 static int check_kfunc_call(struct bpf_verifier_env *env, struct bpf_insn *insn,
12811 int *insn_idx_p)
12812 {
12813 bool sleepable, rcu_lock, rcu_unlock, preempt_disable, preempt_enable;
12814 struct bpf_reg_state *regs = cur_regs(env);
12815 const char *func_name, *ptr_type_name;
12816 const struct btf_type *t, *ptr_type;
12817 struct bpf_kfunc_call_arg_meta meta;
12818 struct bpf_insn_aux_data *insn_aux;
12819 int err, insn_idx = *insn_idx_p;
12820 u32 i, nargs, ptr_type_id, id;
^^
Originally id was int. It needs to be int for the error handling to
work.
12821 const struct btf_param *args;
12822 struct btf *desc_btf;
12823
12824 /* skip for now, but return error when we find this in fixup_kfunc_call */
[ snip ]
13112 mark_btf_func_reg_size(env, BPF_REG_0, sizeof(void *));
13113 if (is_kfunc_acquire(&meta)) {
13114 id = acquire_reference(env, insn_idx, 0);
--> 13115 if (id < 0)
^^^^^^
13116 return id;
13117 regs[BPF_REG_0].id = id;
13118 } else if (is_rbtree_node_type(ptr_type) || is_list_node_type(ptr_type)) {
13119 ref_set_non_owning(env, ®s[BPF_REG_0]);
This email is a free service from the Smatch-CI project [smatch.sf.net].
regards,
dan carpenter
next reply other threads:[~2026-06-08 14:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-08 14:55 Dan Carpenter [this message]
2026-06-09 18:13 ` [bug report] bpf: Refactor object relationship tracking and fix dynptr UAF bug Amery Hung
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aibX7BzvtbZYoZcY@stanley.mountain \
--to=error27@gmail.com \
--cc=ameryhung@gmail.com \
--cc=bpf@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox