hulk inclusion category: bugfix bugzilla: https://gitee.com/src-openeuler/kernel/issues/IAYRIC CVE: CVE-2024-50063
--------------------------------
Fix kabi breakage in struct bpf_map by using KABI_USE.
Fixes: e0b1224b89c4 ("bpf: Prevent tail call between progs attached to different hooks") Signed-off-by: Pu Lehui pulehui@huawei.com --- include/linux/bpf.h | 3 +-- kernel/bpf/core.c | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/include/linux/bpf.h b/include/linux/bpf.h index e295c1cec087..337134e1c98b 100644 --- a/include/linux/bpf.h +++ b/include/linux/bpf.h @@ -294,7 +294,6 @@ struct bpf_map { * same prog type, JITed flag and xdp_has_frags flag. */ struct { - const struct btf_type *attach_func_proto; spinlock_t lock; enum bpf_prog_type type; bool jited; @@ -307,7 +306,7 @@ struct bpf_map { s64 __percpu *elem_count;
KABI_USE(1, atomic64_t sleepable_refcnt) - KABI_RESERVE(2) + KABI_USE(2, const struct btf_type *attach_func_proto) KABI_RESERVE(3) KABI_RESERVE(4) }; diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c index 109110cabc4e..7c00bb2ad004 100644 --- a/kernel/bpf/core.c +++ b/kernel/bpf/core.c @@ -2280,14 +2280,14 @@ bool bpf_prog_map_compatible(struct bpf_map *map, map->owner.type = prog_type; map->owner.jited = fp->jited; map->owner.xdp_has_frags = aux->xdp_has_frags; - map->owner.attach_func_proto = aux->attach_func_proto; + map->attach_func_proto = aux->attach_func_proto; ret = true; } else { ret = map->owner.type == prog_type && map->owner.jited == fp->jited && map->owner.xdp_has_frags == aux->xdp_has_frags; if (ret && - map->owner.attach_func_proto != aux->attach_func_proto) { + map->attach_func_proto != aux->attach_func_proto) { switch (prog_type) { case BPF_PROG_TYPE_TRACING: case BPF_PROG_TYPE_LSM: