“74bc2ecfb5ca14d22eec1b6b8d476735067fa8db”上不存在“test/java/util/LinkedHashMap/ComputeIfAbsentAccessOrder.java”
提交 678cd0eb 编写于 作者: A Alexei Starovoitov 提交者: Zheng Zengkai

libbpf: Fix gen_loader assumption on number of programs.

mainline inclusion
from mainline-5.17-rc1
commit 259172bb
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I5EUVD
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=259172bb6514758ce3be1610c500b51a9f44212a

-------------------------------------------------

libbpf's obj->nr_programs includes static and global functions. That number
could be higher than the actual number of bpf programs going be loaded by
gen_loader. Passing larger nr_programs to bpf_gen__init() doesn't hurt. Those
exra stack slots will stay as zero. bpf_gen__finish() needs to check that
actual number of progs that gen_loader saw is less than or equal to
obj->nr_programs.

Fixes: ba05fd36 ("libbpf: Perform map fd cleanup for gen_loader in case of error")
Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
(cherry picked from commit 259172bb)
Signed-off-by: NWang Yufen <wangyufen@huawei.com>
上级 66648b66
...@@ -371,8 +371,9 @@ int bpf_gen__finish(struct bpf_gen *gen, int nr_progs, int nr_maps) ...@@ -371,8 +371,9 @@ int bpf_gen__finish(struct bpf_gen *gen, int nr_progs, int nr_maps)
{ {
int i; int i;
if (nr_progs != gen->nr_progs || nr_maps != gen->nr_maps) { if (nr_progs < gen->nr_progs || nr_maps != gen->nr_maps) {
pr_warn("progs/maps mismatch\n"); pr_warn("nr_progs %d/%d nr_maps %d/%d mismatch\n",
nr_progs, gen->nr_progs, nr_maps, gen->nr_maps);
gen->error = -EFAULT; gen->error = -EFAULT;
return gen->error; return gen->error;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册