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

selftests/bpf: Check combination of jit blinding and pointers to bpf subprogs.

Check that ld_imm64 with src_reg=1 (aka BPF_PSEUDO_FUNC) works
with jit_blinding.

Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Link: https://lore.kernel.org/bpf/20220513011025.13344-2-alexei.starovoitov@gmail.com

authored by

Alexei Starovoitov and committed by
Daniel Borkmann
365d5199 4b6313cf

+8
+8
tools/testing/selftests/bpf/progs/test_subprogs.c
··· 89 89 return 0; 90 90 } 91 91 92 + static int empty_callback(__u32 index, void *data) 93 + { 94 + return 0; 95 + } 96 + 92 97 /* prog3 has the same section name as prog1 */ 93 98 SEC("raw_tp/sys_enter") 94 99 int prog3(void *ctx) ··· 102 97 103 98 if (!BPF_CORE_READ(t, pid) || !get_task_tgid((uintptr_t)t)) 104 99 return 1; 100 + 101 + /* test that ld_imm64 with BPF_PSEUDO_FUNC doesn't get blinded */ 102 + bpf_loop(1, empty_callback, NULL, 0); 105 103 106 104 res3 = sub3(5) + 6; /* (5 + 3 + (4 + 1)) + 6 = 19 */ 107 105 return 0;