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 7 struct { 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 14 SEC("socket") 15 __description("invalid map type for tail call") 16 __failure __msg("expected prog array map for tail call") 17 __failure_unpriv invalid_map_for_tail_call(void)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 31 char _license[] SEC("license") = "GPL"; 32