Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

s390/bpf: Fix indirect trampoline generation

The func_addr used to be NULL for indirect trampolines used by struct_ops.
Now func_addr is a valid function pointer.
Hence use BPF_TRAMP_F_INDIRECT flag to detect such condition.

Fixes: 2cd3e3772e41 ("x86/cfi,bpf: Fix bpf_struct_ops CFI")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com>
Link: https://lore.kernel.org/bpf/20231216004549.78355-1-alexei.starovoitov@gmail.com

authored by

Alexei Starovoitov and committed by
Daniel Borkmann
0c970ed2 42d45c45

+2 -3
+2 -1
arch/s390/net/bpf_jit_comp.c
··· 2362 2362 return -ENOTSUPP; 2363 2363 2364 2364 /* Return to %r14, since func_addr and %r0 are not available. */ 2365 - if (!func_addr && !(flags & BPF_TRAMP_F_ORIG_STACK)) 2365 + if ((!func_addr && !(flags & BPF_TRAMP_F_ORIG_STACK)) || 2366 + (flags & BPF_TRAMP_F_INDIRECT)) 2366 2367 flags |= BPF_TRAMP_F_SKIP_FRAME; 2367 2368 2368 2369 /*
-2
tools/testing/selftests/bpf/DENYLIST.s390x
··· 1 1 # TEMPORARY 2 2 # Alphabetical order 3 - dummy_st_ops/dummy_init_ret_value 4 - dummy_st_ops/dummy_init_ptr_arg 5 3 exceptions # JIT does not support calling kfunc bpf_throw (exceptions) 6 4 get_stack_raw_tp # user_stack corrupted user stack (no backchain userspace) 7 5 stacktrace_build_id # compare_map_keys stackid_hmap vs. stackmap err -2 errno 2 (?)