File Index
Files and directories
Sign in
FILE

verifier_tailcall.c

File preview with syntax highlighting.

linux-6.19.14/tools/testing/selftests/bpf/progs/verifier_tailcall.c C
 1// SPDX-License-Identifier: GPL-2.0
 2
 3#include <linux/bpf.h>
 4#include <bpf/bpf_helpers.h>
 5#include "bpf_misc.h"
 6
 7struct {
 8	__uint(type, BPF_MAP_TYPE_ARRAY);
 9	__uint(max_entries, 1);
10	__type(key, __u32);
11	__type(value, __u32);
12} map_array SEC(".maps");
13
14SEC("socket")
15__description("invalid map type for tail call")
16__failure __msg("expected prog array map for tail call")
17__failure_unpriv
18__naked void invalid_map_for_tail_call(void)
19{
20	asm volatile ("			\
21	r2 = %[map_array] ll;	\
22	r3 = 0;				\
23	call %[bpf_tail_call];		\
24	exit;				\
25"	:
26	: __imm(bpf_tail_call),
27	  __imm_addr(map_array)
28	: __clobber_all);
29}
30
31char _license[] SEC("license") = "GPL";
~/ Read-only file preview.