From: Hou Tao <houtao1@xxxxxxxxxx> For map with dynptr key, batched map operations and dumping all elements through bpffs file are not yet supported. Therefore, disable these functionalities for now. Signed-off-by: Hou Tao <houtao1@xxxxxxxxxx> --- include/linux/bpf.h | 3 ++- kernel/bpf/syscall.c | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/include/linux/bpf.h b/include/linux/bpf.h index 3e25e94b7457..127952377025 100644 --- a/include/linux/bpf.h +++ b/include/linux/bpf.h @@ -592,7 +592,8 @@ static inline bool bpf_map_offload_neutral(const struct bpf_map *map) static inline bool bpf_map_support_seq_show(const struct bpf_map *map) { return (map->btf_value_type_id || map->btf_vmlinux_value_type_id) && - map->ops->map_seq_show_elem; + map->ops->map_seq_show_elem && + !bpf_map_has_dynptr_key(map); } int map_check_no_btf(const struct bpf_map *map, diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c index 338f17530068..262f8a5541b6 100644 --- a/kernel/bpf/syscall.c +++ b/kernel/bpf/syscall.c @@ -5316,6 +5316,10 @@ static int bpf_map_do_batch(const union bpf_attr *attr, err = -EPERM; goto err_put; } + if (bpf_map_has_dynptr_key(map)) { + err = -EOPNOTSUPP; + goto err_put; + } if (cmd == BPF_MAP_LOOKUP_BATCH) BPF_DO_BATCH(map->ops->map_lookup_batch, map, attr, uattr); -- 2.44.0