From ac80043d0fce9125352f7d7559b72c258afdc549 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 5 May 2025 12:54:20 +0000 Subject: [PATCH] Revert "bpf: Prevent tail call between progs attached to different hooks" This reverts commit d9a807fb7cbfad4328824186e2e4bee28f72169b which is commit 28ead3eaabc16ecc907cfb71876da028080f6356 upstream. It breaks the Android kernel abi and can be brought back in the future in an abi-safe way if it is really needed. Bug: 161946584 Change-Id: I8a5f9e59898eb41170e6562631ac23ab81f1271c Signed-off-by: Greg Kroah-Hartman --- include/linux/bpf.h | 1 - kernel/bpf/core.c | 19 ++----------------- 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/include/linux/bpf.h b/include/linux/bpf.h index 108a152dab38..69d231e9a199 100644 --- a/include/linux/bpf.h +++ b/include/linux/bpf.h @@ -246,7 +246,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; diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c index 1a1313bac8ea..254018cc70d0 100644 --- a/kernel/bpf/core.c +++ b/kernel/bpf/core.c @@ -2104,7 +2104,6 @@ bool bpf_prog_map_compatible(struct bpf_map *map, { enum bpf_prog_type prog_type = resolve_prog_type(fp); bool ret; - struct bpf_prog_aux *aux = fp->aux; if (fp->kprobe_override) return false; @@ -2116,26 +2115,12 @@ 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->owner.xdp_has_frags = fp->aux->xdp_has_frags; 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) { - switch (prog_type) { - case BPF_PROG_TYPE_TRACING: - case BPF_PROG_TYPE_LSM: - case BPF_PROG_TYPE_EXT: - case BPF_PROG_TYPE_STRUCT_OPS: - ret = false; - break; - default: - break; - } - } + map->owner.xdp_has_frags == fp->aux->xdp_has_frags; } spin_unlock(&map->owner.lock);