1b1b53d41SAndrey Ignatov // SPDX-License-Identifier: GPL-2.0 2b1b53d41SAndrey Ignatov // Copyright (c) 2020 Facebook 3b1b53d41SAndrey Ignatov 4b1b53d41SAndrey Ignatov #include <linux/bpf.h> 5b1b53d41SAndrey Ignatov #include <bpf/bpf_helpers.h> 6b1b53d41SAndrey Ignatov 7b1b53d41SAndrey Ignatov #define LOOP_BOUND 0xf 8b1b53d41SAndrey Ignatov #define MAX_ENTRIES 8 9b1b53d41SAndrey Ignatov #define HALF_ENTRIES (MAX_ENTRIES >> 1) 10b1b53d41SAndrey Ignatov 11b1b53d41SAndrey Ignatov _Static_assert(MAX_ENTRIES < LOOP_BOUND, "MAX_ENTRIES must be < LOOP_BOUND"); 12b1b53d41SAndrey Ignatov 13b1b53d41SAndrey Ignatov enum bpf_map_type g_map_type = BPF_MAP_TYPE_UNSPEC; 14b1b53d41SAndrey Ignatov __u32 g_line = 0; 15b1b53d41SAndrey Ignatov 16b1b53d41SAndrey Ignatov #define VERIFY_TYPE(type, func) ({ \ 17b1b53d41SAndrey Ignatov g_map_type = type; \ 18b1b53d41SAndrey Ignatov if (!func()) \ 19b1b53d41SAndrey Ignatov return 0; \ 20b1b53d41SAndrey Ignatov }) 21b1b53d41SAndrey Ignatov 22b1b53d41SAndrey Ignatov 23b1b53d41SAndrey Ignatov #define VERIFY(expr) ({ \ 24b1b53d41SAndrey Ignatov g_line = __LINE__; \ 25b1b53d41SAndrey Ignatov if (!(expr)) \ 26b1b53d41SAndrey Ignatov return 0; \ 27b1b53d41SAndrey Ignatov }) 28b1b53d41SAndrey Ignatov 29b1b53d41SAndrey Ignatov struct bpf_map_memory { 30b1b53d41SAndrey Ignatov __u32 pages; 31b1b53d41SAndrey Ignatov } __attribute__((preserve_access_index)); 32b1b53d41SAndrey Ignatov 33b1b53d41SAndrey Ignatov struct bpf_map { 34b1b53d41SAndrey Ignatov enum bpf_map_type map_type; 35b1b53d41SAndrey Ignatov __u32 key_size; 36b1b53d41SAndrey Ignatov __u32 value_size; 37b1b53d41SAndrey Ignatov __u32 max_entries; 38b1b53d41SAndrey Ignatov __u32 id; 39b1b53d41SAndrey Ignatov struct bpf_map_memory memory; 40b1b53d41SAndrey Ignatov } __attribute__((preserve_access_index)); 41b1b53d41SAndrey Ignatov 42b1b53d41SAndrey Ignatov static inline int check_bpf_map_fields(struct bpf_map *map, __u32 key_size, 43b1b53d41SAndrey Ignatov __u32 value_size, __u32 max_entries) 44b1b53d41SAndrey Ignatov { 45b1b53d41SAndrey Ignatov VERIFY(map->map_type == g_map_type); 46b1b53d41SAndrey Ignatov VERIFY(map->key_size == key_size); 47b1b53d41SAndrey Ignatov VERIFY(map->value_size == value_size); 48b1b53d41SAndrey Ignatov VERIFY(map->max_entries == max_entries); 49b1b53d41SAndrey Ignatov VERIFY(map->id > 0); 50b1b53d41SAndrey Ignatov VERIFY(map->memory.pages > 0); 51b1b53d41SAndrey Ignatov 52b1b53d41SAndrey Ignatov return 1; 53b1b53d41SAndrey Ignatov } 54b1b53d41SAndrey Ignatov 55b1b53d41SAndrey Ignatov static inline int check_bpf_map_ptr(struct bpf_map *indirect, 56b1b53d41SAndrey Ignatov struct bpf_map *direct) 57b1b53d41SAndrey Ignatov { 58b1b53d41SAndrey Ignatov VERIFY(indirect->map_type == direct->map_type); 59b1b53d41SAndrey Ignatov VERIFY(indirect->key_size == direct->key_size); 60b1b53d41SAndrey Ignatov VERIFY(indirect->value_size == direct->value_size); 61b1b53d41SAndrey Ignatov VERIFY(indirect->max_entries == direct->max_entries); 62b1b53d41SAndrey Ignatov VERIFY(indirect->id == direct->id); 63b1b53d41SAndrey Ignatov VERIFY(indirect->memory.pages == direct->memory.pages); 64b1b53d41SAndrey Ignatov 65b1b53d41SAndrey Ignatov return 1; 66b1b53d41SAndrey Ignatov } 67b1b53d41SAndrey Ignatov 68b1b53d41SAndrey Ignatov static inline int check(struct bpf_map *indirect, struct bpf_map *direct, 69b1b53d41SAndrey Ignatov __u32 key_size, __u32 value_size, __u32 max_entries) 70b1b53d41SAndrey Ignatov { 71b1b53d41SAndrey Ignatov VERIFY(check_bpf_map_ptr(indirect, direct)); 72b1b53d41SAndrey Ignatov VERIFY(check_bpf_map_fields(indirect, key_size, value_size, 73b1b53d41SAndrey Ignatov max_entries)); 74b1b53d41SAndrey Ignatov return 1; 75b1b53d41SAndrey Ignatov } 76b1b53d41SAndrey Ignatov 77b1b53d41SAndrey Ignatov static inline int check_default(struct bpf_map *indirect, 78b1b53d41SAndrey Ignatov struct bpf_map *direct) 79b1b53d41SAndrey Ignatov { 80b1b53d41SAndrey Ignatov VERIFY(check(indirect, direct, sizeof(__u32), sizeof(__u32), 81b1b53d41SAndrey Ignatov MAX_ENTRIES)); 82b1b53d41SAndrey Ignatov return 1; 83b1b53d41SAndrey Ignatov } 84b1b53d41SAndrey Ignatov 85b1b53d41SAndrey Ignatov typedef struct { 86b1b53d41SAndrey Ignatov int counter; 87b1b53d41SAndrey Ignatov } atomic_t; 88b1b53d41SAndrey Ignatov 89b1b53d41SAndrey Ignatov struct bpf_htab { 90b1b53d41SAndrey Ignatov struct bpf_map map; 91b1b53d41SAndrey Ignatov atomic_t count; 92b1b53d41SAndrey Ignatov __u32 n_buckets; 93b1b53d41SAndrey Ignatov __u32 elem_size; 94b1b53d41SAndrey Ignatov } __attribute__((preserve_access_index)); 95b1b53d41SAndrey Ignatov 96b1b53d41SAndrey Ignatov struct { 97b1b53d41SAndrey Ignatov __uint(type, BPF_MAP_TYPE_HASH); 98b1b53d41SAndrey Ignatov __uint(map_flags, BPF_F_NO_PREALLOC); /* to test bpf_htab.count */ 99b1b53d41SAndrey Ignatov __uint(max_entries, MAX_ENTRIES); 100b1b53d41SAndrey Ignatov __type(key, __u32); 101b1b53d41SAndrey Ignatov __type(value, __u32); 102b1b53d41SAndrey Ignatov } m_hash SEC(".maps"); 103b1b53d41SAndrey Ignatov 104b1b53d41SAndrey Ignatov static inline int check_hash(void) 105b1b53d41SAndrey Ignatov { 106b1b53d41SAndrey Ignatov struct bpf_htab *hash = (struct bpf_htab *)&m_hash; 107b1b53d41SAndrey Ignatov struct bpf_map *map = (struct bpf_map *)&m_hash; 108b1b53d41SAndrey Ignatov int i; 109b1b53d41SAndrey Ignatov 110b1b53d41SAndrey Ignatov VERIFY(check_default(&hash->map, map)); 111b1b53d41SAndrey Ignatov 112b1b53d41SAndrey Ignatov VERIFY(hash->n_buckets == MAX_ENTRIES); 113b1b53d41SAndrey Ignatov VERIFY(hash->elem_size == 64); 114b1b53d41SAndrey Ignatov 115b1b53d41SAndrey Ignatov VERIFY(hash->count.counter == 0); 116b1b53d41SAndrey Ignatov for (i = 0; i < HALF_ENTRIES; ++i) { 117b1b53d41SAndrey Ignatov const __u32 key = i; 118b1b53d41SAndrey Ignatov const __u32 val = 1; 119b1b53d41SAndrey Ignatov 120b1b53d41SAndrey Ignatov if (bpf_map_update_elem(hash, &key, &val, 0)) 121b1b53d41SAndrey Ignatov return 0; 122b1b53d41SAndrey Ignatov } 123b1b53d41SAndrey Ignatov VERIFY(hash->count.counter == HALF_ENTRIES); 124b1b53d41SAndrey Ignatov 125b1b53d41SAndrey Ignatov return 1; 126b1b53d41SAndrey Ignatov } 127b1b53d41SAndrey Ignatov 128b1b53d41SAndrey Ignatov struct bpf_array { 129b1b53d41SAndrey Ignatov struct bpf_map map; 130b1b53d41SAndrey Ignatov __u32 elem_size; 131b1b53d41SAndrey Ignatov } __attribute__((preserve_access_index)); 132b1b53d41SAndrey Ignatov 133b1b53d41SAndrey Ignatov struct { 134b1b53d41SAndrey Ignatov __uint(type, BPF_MAP_TYPE_ARRAY); 135b1b53d41SAndrey Ignatov __uint(max_entries, MAX_ENTRIES); 136b1b53d41SAndrey Ignatov __type(key, __u32); 137b1b53d41SAndrey Ignatov __type(value, __u32); 138b1b53d41SAndrey Ignatov } m_array SEC(".maps"); 139b1b53d41SAndrey Ignatov 140b1b53d41SAndrey Ignatov static inline int check_array(void) 141b1b53d41SAndrey Ignatov { 142b1b53d41SAndrey Ignatov struct bpf_array *array = (struct bpf_array *)&m_array; 143b1b53d41SAndrey Ignatov struct bpf_map *map = (struct bpf_map *)&m_array; 144b1b53d41SAndrey Ignatov int i, n_lookups = 0, n_keys = 0; 145b1b53d41SAndrey Ignatov 146b1b53d41SAndrey Ignatov VERIFY(check_default(&array->map, map)); 147b1b53d41SAndrey Ignatov 148b1b53d41SAndrey Ignatov VERIFY(array->elem_size == 8); 149b1b53d41SAndrey Ignatov 150b1b53d41SAndrey Ignatov for (i = 0; i < array->map.max_entries && i < LOOP_BOUND; ++i) { 151b1b53d41SAndrey Ignatov const __u32 key = i; 152b1b53d41SAndrey Ignatov __u32 *val = bpf_map_lookup_elem(array, &key); 153b1b53d41SAndrey Ignatov 154b1b53d41SAndrey Ignatov ++n_lookups; 155b1b53d41SAndrey Ignatov if (val) 156b1b53d41SAndrey Ignatov ++n_keys; 157b1b53d41SAndrey Ignatov } 158b1b53d41SAndrey Ignatov 159b1b53d41SAndrey Ignatov VERIFY(n_lookups == MAX_ENTRIES); 160b1b53d41SAndrey Ignatov VERIFY(n_keys == MAX_ENTRIES); 161b1b53d41SAndrey Ignatov 162b1b53d41SAndrey Ignatov return 1; 163b1b53d41SAndrey Ignatov } 164b1b53d41SAndrey Ignatov 165b1b53d41SAndrey Ignatov struct { 166b1b53d41SAndrey Ignatov __uint(type, BPF_MAP_TYPE_PROG_ARRAY); 167b1b53d41SAndrey Ignatov __uint(max_entries, MAX_ENTRIES); 168b1b53d41SAndrey Ignatov __type(key, __u32); 169b1b53d41SAndrey Ignatov __type(value, __u32); 170b1b53d41SAndrey Ignatov } m_prog_array SEC(".maps"); 171b1b53d41SAndrey Ignatov 172b1b53d41SAndrey Ignatov static inline int check_prog_array(void) 173b1b53d41SAndrey Ignatov { 174b1b53d41SAndrey Ignatov struct bpf_array *prog_array = (struct bpf_array *)&m_prog_array; 175b1b53d41SAndrey Ignatov struct bpf_map *map = (struct bpf_map *)&m_prog_array; 176b1b53d41SAndrey Ignatov 177b1b53d41SAndrey Ignatov VERIFY(check_default(&prog_array->map, map)); 178b1b53d41SAndrey Ignatov 179b1b53d41SAndrey Ignatov return 1; 180b1b53d41SAndrey Ignatov } 181b1b53d41SAndrey Ignatov 182b1b53d41SAndrey Ignatov struct { 183b1b53d41SAndrey Ignatov __uint(type, BPF_MAP_TYPE_PERF_EVENT_ARRAY); 184b1b53d41SAndrey Ignatov __uint(max_entries, MAX_ENTRIES); 185b1b53d41SAndrey Ignatov __type(key, __u32); 186b1b53d41SAndrey Ignatov __type(value, __u32); 187b1b53d41SAndrey Ignatov } m_perf_event_array SEC(".maps"); 188b1b53d41SAndrey Ignatov 189b1b53d41SAndrey Ignatov static inline int check_perf_event_array(void) 190b1b53d41SAndrey Ignatov { 191b1b53d41SAndrey Ignatov struct bpf_array *perf_event_array = (struct bpf_array *)&m_perf_event_array; 192b1b53d41SAndrey Ignatov struct bpf_map *map = (struct bpf_map *)&m_perf_event_array; 193b1b53d41SAndrey Ignatov 194b1b53d41SAndrey Ignatov VERIFY(check_default(&perf_event_array->map, map)); 195b1b53d41SAndrey Ignatov 196b1b53d41SAndrey Ignatov return 1; 197b1b53d41SAndrey Ignatov } 198b1b53d41SAndrey Ignatov 199b1b53d41SAndrey Ignatov struct { 200b1b53d41SAndrey Ignatov __uint(type, BPF_MAP_TYPE_PERCPU_HASH); 201b1b53d41SAndrey Ignatov __uint(max_entries, MAX_ENTRIES); 202b1b53d41SAndrey Ignatov __type(key, __u32); 203b1b53d41SAndrey Ignatov __type(value, __u32); 204b1b53d41SAndrey Ignatov } m_percpu_hash SEC(".maps"); 205b1b53d41SAndrey Ignatov 206b1b53d41SAndrey Ignatov static inline int check_percpu_hash(void) 207b1b53d41SAndrey Ignatov { 208b1b53d41SAndrey Ignatov struct bpf_htab *percpu_hash = (struct bpf_htab *)&m_percpu_hash; 209b1b53d41SAndrey Ignatov struct bpf_map *map = (struct bpf_map *)&m_percpu_hash; 210b1b53d41SAndrey Ignatov 211b1b53d41SAndrey Ignatov VERIFY(check_default(&percpu_hash->map, map)); 212b1b53d41SAndrey Ignatov 213b1b53d41SAndrey Ignatov return 1; 214b1b53d41SAndrey Ignatov } 215b1b53d41SAndrey Ignatov 216b1b53d41SAndrey Ignatov struct { 217b1b53d41SAndrey Ignatov __uint(type, BPF_MAP_TYPE_PERCPU_ARRAY); 218b1b53d41SAndrey Ignatov __uint(max_entries, MAX_ENTRIES); 219b1b53d41SAndrey Ignatov __type(key, __u32); 220b1b53d41SAndrey Ignatov __type(value, __u32); 221b1b53d41SAndrey Ignatov } m_percpu_array SEC(".maps"); 222b1b53d41SAndrey Ignatov 223b1b53d41SAndrey Ignatov static inline int check_percpu_array(void) 224b1b53d41SAndrey Ignatov { 225b1b53d41SAndrey Ignatov struct bpf_array *percpu_array = (struct bpf_array *)&m_percpu_array; 226b1b53d41SAndrey Ignatov struct bpf_map *map = (struct bpf_map *)&m_percpu_array; 227b1b53d41SAndrey Ignatov 228b1b53d41SAndrey Ignatov VERIFY(check_default(&percpu_array->map, map)); 229b1b53d41SAndrey Ignatov 230b1b53d41SAndrey Ignatov return 1; 231b1b53d41SAndrey Ignatov } 232b1b53d41SAndrey Ignatov 233b1b53d41SAndrey Ignatov struct bpf_stack_map { 234b1b53d41SAndrey Ignatov struct bpf_map map; 235b1b53d41SAndrey Ignatov } __attribute__((preserve_access_index)); 236b1b53d41SAndrey Ignatov 237b1b53d41SAndrey Ignatov struct { 238b1b53d41SAndrey Ignatov __uint(type, BPF_MAP_TYPE_STACK_TRACE); 239b1b53d41SAndrey Ignatov __uint(max_entries, MAX_ENTRIES); 240b1b53d41SAndrey Ignatov __type(key, __u32); 241b1b53d41SAndrey Ignatov __type(value, __u64); 242b1b53d41SAndrey Ignatov } m_stack_trace SEC(".maps"); 243b1b53d41SAndrey Ignatov 244b1b53d41SAndrey Ignatov static inline int check_stack_trace(void) 245b1b53d41SAndrey Ignatov { 246b1b53d41SAndrey Ignatov struct bpf_stack_map *stack_trace = 247b1b53d41SAndrey Ignatov (struct bpf_stack_map *)&m_stack_trace; 248b1b53d41SAndrey Ignatov struct bpf_map *map = (struct bpf_map *)&m_stack_trace; 249b1b53d41SAndrey Ignatov 250b1b53d41SAndrey Ignatov VERIFY(check(&stack_trace->map, map, sizeof(__u32), sizeof(__u64), 251b1b53d41SAndrey Ignatov MAX_ENTRIES)); 252b1b53d41SAndrey Ignatov 253b1b53d41SAndrey Ignatov return 1; 254b1b53d41SAndrey Ignatov } 255b1b53d41SAndrey Ignatov 256b1b53d41SAndrey Ignatov struct { 257b1b53d41SAndrey Ignatov __uint(type, BPF_MAP_TYPE_CGROUP_ARRAY); 258b1b53d41SAndrey Ignatov __uint(max_entries, MAX_ENTRIES); 259b1b53d41SAndrey Ignatov __type(key, __u32); 260b1b53d41SAndrey Ignatov __type(value, __u32); 261b1b53d41SAndrey Ignatov } m_cgroup_array SEC(".maps"); 262b1b53d41SAndrey Ignatov 263b1b53d41SAndrey Ignatov static inline int check_cgroup_array(void) 264b1b53d41SAndrey Ignatov { 265b1b53d41SAndrey Ignatov struct bpf_array *cgroup_array = (struct bpf_array *)&m_cgroup_array; 266b1b53d41SAndrey Ignatov struct bpf_map *map = (struct bpf_map *)&m_cgroup_array; 267b1b53d41SAndrey Ignatov 268b1b53d41SAndrey Ignatov VERIFY(check_default(&cgroup_array->map, map)); 269b1b53d41SAndrey Ignatov 270b1b53d41SAndrey Ignatov return 1; 271b1b53d41SAndrey Ignatov } 272b1b53d41SAndrey Ignatov 273b1b53d41SAndrey Ignatov struct { 274b1b53d41SAndrey Ignatov __uint(type, BPF_MAP_TYPE_LRU_HASH); 275b1b53d41SAndrey Ignatov __uint(max_entries, MAX_ENTRIES); 276b1b53d41SAndrey Ignatov __type(key, __u32); 277b1b53d41SAndrey Ignatov __type(value, __u32); 278b1b53d41SAndrey Ignatov } m_lru_hash SEC(".maps"); 279b1b53d41SAndrey Ignatov 280b1b53d41SAndrey Ignatov static inline int check_lru_hash(void) 281b1b53d41SAndrey Ignatov { 282b1b53d41SAndrey Ignatov struct bpf_htab *lru_hash = (struct bpf_htab *)&m_lru_hash; 283b1b53d41SAndrey Ignatov struct bpf_map *map = (struct bpf_map *)&m_lru_hash; 284b1b53d41SAndrey Ignatov 285b1b53d41SAndrey Ignatov VERIFY(check_default(&lru_hash->map, map)); 286b1b53d41SAndrey Ignatov 287b1b53d41SAndrey Ignatov return 1; 288b1b53d41SAndrey Ignatov } 289b1b53d41SAndrey Ignatov 290b1b53d41SAndrey Ignatov struct { 291b1b53d41SAndrey Ignatov __uint(type, BPF_MAP_TYPE_LRU_PERCPU_HASH); 292b1b53d41SAndrey Ignatov __uint(max_entries, MAX_ENTRIES); 293b1b53d41SAndrey Ignatov __type(key, __u32); 294b1b53d41SAndrey Ignatov __type(value, __u32); 295b1b53d41SAndrey Ignatov } m_lru_percpu_hash SEC(".maps"); 296b1b53d41SAndrey Ignatov 297b1b53d41SAndrey Ignatov static inline int check_lru_percpu_hash(void) 298b1b53d41SAndrey Ignatov { 299b1b53d41SAndrey Ignatov struct bpf_htab *lru_percpu_hash = (struct bpf_htab *)&m_lru_percpu_hash; 300b1b53d41SAndrey Ignatov struct bpf_map *map = (struct bpf_map *)&m_lru_percpu_hash; 301b1b53d41SAndrey Ignatov 302b1b53d41SAndrey Ignatov VERIFY(check_default(&lru_percpu_hash->map, map)); 303b1b53d41SAndrey Ignatov 304b1b53d41SAndrey Ignatov return 1; 305b1b53d41SAndrey Ignatov } 306b1b53d41SAndrey Ignatov 307b1b53d41SAndrey Ignatov struct lpm_trie { 308b1b53d41SAndrey Ignatov struct bpf_map map; 309b1b53d41SAndrey Ignatov } __attribute__((preserve_access_index)); 310b1b53d41SAndrey Ignatov 311b1b53d41SAndrey Ignatov struct lpm_key { 312b1b53d41SAndrey Ignatov struct bpf_lpm_trie_key trie_key; 313b1b53d41SAndrey Ignatov __u32 data; 314b1b53d41SAndrey Ignatov }; 315b1b53d41SAndrey Ignatov 316b1b53d41SAndrey Ignatov struct { 317b1b53d41SAndrey Ignatov __uint(type, BPF_MAP_TYPE_LPM_TRIE); 318b1b53d41SAndrey Ignatov __uint(map_flags, BPF_F_NO_PREALLOC); 319b1b53d41SAndrey Ignatov __uint(max_entries, MAX_ENTRIES); 320b1b53d41SAndrey Ignatov __type(key, struct lpm_key); 321b1b53d41SAndrey Ignatov __type(value, __u32); 322b1b53d41SAndrey Ignatov } m_lpm_trie SEC(".maps"); 323b1b53d41SAndrey Ignatov 324b1b53d41SAndrey Ignatov static inline int check_lpm_trie(void) 325b1b53d41SAndrey Ignatov { 326b1b53d41SAndrey Ignatov struct lpm_trie *lpm_trie = (struct lpm_trie *)&m_lpm_trie; 327b1b53d41SAndrey Ignatov struct bpf_map *map = (struct bpf_map *)&m_lpm_trie; 328b1b53d41SAndrey Ignatov 329b1b53d41SAndrey Ignatov VERIFY(check(&lpm_trie->map, map, sizeof(struct lpm_key), sizeof(__u32), 330b1b53d41SAndrey Ignatov MAX_ENTRIES)); 331b1b53d41SAndrey Ignatov 332b1b53d41SAndrey Ignatov return 1; 333b1b53d41SAndrey Ignatov } 334b1b53d41SAndrey Ignatov 335b1b53d41SAndrey Ignatov struct inner_map { 336b1b53d41SAndrey Ignatov __uint(type, BPF_MAP_TYPE_ARRAY); 337b1b53d41SAndrey Ignatov __uint(max_entries, 1); 338b1b53d41SAndrey Ignatov __type(key, __u32); 339b1b53d41SAndrey Ignatov __type(value, __u32); 340b1b53d41SAndrey Ignatov } inner_map SEC(".maps"); 341b1b53d41SAndrey Ignatov 342b1b53d41SAndrey Ignatov struct { 343b1b53d41SAndrey Ignatov __uint(type, BPF_MAP_TYPE_ARRAY_OF_MAPS); 344b1b53d41SAndrey Ignatov __uint(max_entries, MAX_ENTRIES); 345b1b53d41SAndrey Ignatov __type(key, __u32); 346b1b53d41SAndrey Ignatov __type(value, __u32); 347b1b53d41SAndrey Ignatov __array(values, struct { 348b1b53d41SAndrey Ignatov __uint(type, BPF_MAP_TYPE_ARRAY); 349b1b53d41SAndrey Ignatov __uint(max_entries, 1); 350b1b53d41SAndrey Ignatov __type(key, __u32); 351b1b53d41SAndrey Ignatov __type(value, __u32); 352b1b53d41SAndrey Ignatov }); 353b1b53d41SAndrey Ignatov } m_array_of_maps SEC(".maps") = { 354b1b53d41SAndrey Ignatov .values = { (void *)&inner_map, 0, 0, 0, 0, 0, 0, 0, 0 }, 355b1b53d41SAndrey Ignatov }; 356b1b53d41SAndrey Ignatov 357b1b53d41SAndrey Ignatov static inline int check_array_of_maps(void) 358b1b53d41SAndrey Ignatov { 359b1b53d41SAndrey Ignatov struct bpf_array *array_of_maps = (struct bpf_array *)&m_array_of_maps; 360b1b53d41SAndrey Ignatov struct bpf_map *map = (struct bpf_map *)&m_array_of_maps; 361b1b53d41SAndrey Ignatov 362b1b53d41SAndrey Ignatov VERIFY(check_default(&array_of_maps->map, map)); 363b1b53d41SAndrey Ignatov 364b1b53d41SAndrey Ignatov return 1; 365b1b53d41SAndrey Ignatov } 366b1b53d41SAndrey Ignatov 367b1b53d41SAndrey Ignatov struct { 368b1b53d41SAndrey Ignatov __uint(type, BPF_MAP_TYPE_HASH_OF_MAPS); 369b1b53d41SAndrey Ignatov __uint(max_entries, MAX_ENTRIES); 370b1b53d41SAndrey Ignatov __type(key, __u32); 371b1b53d41SAndrey Ignatov __type(value, __u32); 372b1b53d41SAndrey Ignatov __array(values, struct inner_map); 373b1b53d41SAndrey Ignatov } m_hash_of_maps SEC(".maps") = { 374b1b53d41SAndrey Ignatov .values = { 375b1b53d41SAndrey Ignatov [2] = &inner_map, 376b1b53d41SAndrey Ignatov }, 377b1b53d41SAndrey Ignatov }; 378b1b53d41SAndrey Ignatov 379b1b53d41SAndrey Ignatov static inline int check_hash_of_maps(void) 380b1b53d41SAndrey Ignatov { 381b1b53d41SAndrey Ignatov struct bpf_htab *hash_of_maps = (struct bpf_htab *)&m_hash_of_maps; 382b1b53d41SAndrey Ignatov struct bpf_map *map = (struct bpf_map *)&m_hash_of_maps; 383b1b53d41SAndrey Ignatov 384b1b53d41SAndrey Ignatov VERIFY(check_default(&hash_of_maps->map, map)); 385b1b53d41SAndrey Ignatov 386b1b53d41SAndrey Ignatov return 1; 387b1b53d41SAndrey Ignatov } 388b1b53d41SAndrey Ignatov 389b1b53d41SAndrey Ignatov struct bpf_dtab { 390b1b53d41SAndrey Ignatov struct bpf_map map; 391b1b53d41SAndrey Ignatov } __attribute__((preserve_access_index)); 392b1b53d41SAndrey Ignatov 393b1b53d41SAndrey Ignatov struct { 394b1b53d41SAndrey Ignatov __uint(type, BPF_MAP_TYPE_DEVMAP); 395b1b53d41SAndrey Ignatov __uint(max_entries, MAX_ENTRIES); 396b1b53d41SAndrey Ignatov __type(key, __u32); 397b1b53d41SAndrey Ignatov __type(value, __u32); 398b1b53d41SAndrey Ignatov } m_devmap SEC(".maps"); 399b1b53d41SAndrey Ignatov 400b1b53d41SAndrey Ignatov static inline int check_devmap(void) 401b1b53d41SAndrey Ignatov { 402b1b53d41SAndrey Ignatov struct bpf_dtab *devmap = (struct bpf_dtab *)&m_devmap; 403b1b53d41SAndrey Ignatov struct bpf_map *map = (struct bpf_map *)&m_devmap; 404b1b53d41SAndrey Ignatov 405b1b53d41SAndrey Ignatov VERIFY(check_default(&devmap->map, map)); 406b1b53d41SAndrey Ignatov 407b1b53d41SAndrey Ignatov return 1; 408b1b53d41SAndrey Ignatov } 409b1b53d41SAndrey Ignatov 410b1b53d41SAndrey Ignatov struct bpf_stab { 411b1b53d41SAndrey Ignatov struct bpf_map map; 412b1b53d41SAndrey Ignatov } __attribute__((preserve_access_index)); 413b1b53d41SAndrey Ignatov 414b1b53d41SAndrey Ignatov struct { 415b1b53d41SAndrey Ignatov __uint(type, BPF_MAP_TYPE_SOCKMAP); 416b1b53d41SAndrey Ignatov __uint(max_entries, MAX_ENTRIES); 417b1b53d41SAndrey Ignatov __type(key, __u32); 418b1b53d41SAndrey Ignatov __type(value, __u32); 419b1b53d41SAndrey Ignatov } m_sockmap SEC(".maps"); 420b1b53d41SAndrey Ignatov 421b1b53d41SAndrey Ignatov static inline int check_sockmap(void) 422b1b53d41SAndrey Ignatov { 423b1b53d41SAndrey Ignatov struct bpf_stab *sockmap = (struct bpf_stab *)&m_sockmap; 424b1b53d41SAndrey Ignatov struct bpf_map *map = (struct bpf_map *)&m_sockmap; 425b1b53d41SAndrey Ignatov 426b1b53d41SAndrey Ignatov VERIFY(check_default(&sockmap->map, map)); 427b1b53d41SAndrey Ignatov 428b1b53d41SAndrey Ignatov return 1; 429b1b53d41SAndrey Ignatov } 430b1b53d41SAndrey Ignatov 431b1b53d41SAndrey Ignatov struct bpf_cpu_map { 432b1b53d41SAndrey Ignatov struct bpf_map map; 433b1b53d41SAndrey Ignatov } __attribute__((preserve_access_index)); 434b1b53d41SAndrey Ignatov 435b1b53d41SAndrey Ignatov struct { 436b1b53d41SAndrey Ignatov __uint(type, BPF_MAP_TYPE_CPUMAP); 437b1b53d41SAndrey Ignatov __uint(max_entries, MAX_ENTRIES); 438b1b53d41SAndrey Ignatov __type(key, __u32); 439b1b53d41SAndrey Ignatov __type(value, __u32); 440b1b53d41SAndrey Ignatov } m_cpumap SEC(".maps"); 441b1b53d41SAndrey Ignatov 442b1b53d41SAndrey Ignatov static inline int check_cpumap(void) 443b1b53d41SAndrey Ignatov { 444b1b53d41SAndrey Ignatov struct bpf_cpu_map *cpumap = (struct bpf_cpu_map *)&m_cpumap; 445b1b53d41SAndrey Ignatov struct bpf_map *map = (struct bpf_map *)&m_cpumap; 446b1b53d41SAndrey Ignatov 447b1b53d41SAndrey Ignatov VERIFY(check_default(&cpumap->map, map)); 448b1b53d41SAndrey Ignatov 449b1b53d41SAndrey Ignatov return 1; 450b1b53d41SAndrey Ignatov } 451b1b53d41SAndrey Ignatov 452b1b53d41SAndrey Ignatov struct xsk_map { 453b1b53d41SAndrey Ignatov struct bpf_map map; 454b1b53d41SAndrey Ignatov } __attribute__((preserve_access_index)); 455b1b53d41SAndrey Ignatov 456b1b53d41SAndrey Ignatov struct { 457b1b53d41SAndrey Ignatov __uint(type, BPF_MAP_TYPE_XSKMAP); 458b1b53d41SAndrey Ignatov __uint(max_entries, MAX_ENTRIES); 459b1b53d41SAndrey Ignatov __type(key, __u32); 460b1b53d41SAndrey Ignatov __type(value, __u32); 461b1b53d41SAndrey Ignatov } m_xskmap SEC(".maps"); 462b1b53d41SAndrey Ignatov 463b1b53d41SAndrey Ignatov static inline int check_xskmap(void) 464b1b53d41SAndrey Ignatov { 465b1b53d41SAndrey Ignatov struct xsk_map *xskmap = (struct xsk_map *)&m_xskmap; 466b1b53d41SAndrey Ignatov struct bpf_map *map = (struct bpf_map *)&m_xskmap; 467b1b53d41SAndrey Ignatov 468b1b53d41SAndrey Ignatov VERIFY(check_default(&xskmap->map, map)); 469b1b53d41SAndrey Ignatov 470b1b53d41SAndrey Ignatov return 1; 471b1b53d41SAndrey Ignatov } 472b1b53d41SAndrey Ignatov 473b1b53d41SAndrey Ignatov struct bpf_shtab { 474b1b53d41SAndrey Ignatov struct bpf_map map; 475b1b53d41SAndrey Ignatov } __attribute__((preserve_access_index)); 476b1b53d41SAndrey Ignatov 477b1b53d41SAndrey Ignatov struct { 478b1b53d41SAndrey Ignatov __uint(type, BPF_MAP_TYPE_SOCKHASH); 479b1b53d41SAndrey Ignatov __uint(max_entries, MAX_ENTRIES); 480b1b53d41SAndrey Ignatov __type(key, __u32); 481b1b53d41SAndrey Ignatov __type(value, __u32); 482b1b53d41SAndrey Ignatov } m_sockhash SEC(".maps"); 483b1b53d41SAndrey Ignatov 484b1b53d41SAndrey Ignatov static inline int check_sockhash(void) 485b1b53d41SAndrey Ignatov { 486b1b53d41SAndrey Ignatov struct bpf_shtab *sockhash = (struct bpf_shtab *)&m_sockhash; 487b1b53d41SAndrey Ignatov struct bpf_map *map = (struct bpf_map *)&m_sockhash; 488b1b53d41SAndrey Ignatov 489b1b53d41SAndrey Ignatov VERIFY(check_default(&sockhash->map, map)); 490b1b53d41SAndrey Ignatov 491b1b53d41SAndrey Ignatov return 1; 492b1b53d41SAndrey Ignatov } 493b1b53d41SAndrey Ignatov 494b1b53d41SAndrey Ignatov struct bpf_cgroup_storage_map { 495b1b53d41SAndrey Ignatov struct bpf_map map; 496b1b53d41SAndrey Ignatov } __attribute__((preserve_access_index)); 497b1b53d41SAndrey Ignatov 498b1b53d41SAndrey Ignatov struct { 499b1b53d41SAndrey Ignatov __uint(type, BPF_MAP_TYPE_CGROUP_STORAGE); 500b1b53d41SAndrey Ignatov __type(key, struct bpf_cgroup_storage_key); 501b1b53d41SAndrey Ignatov __type(value, __u32); 502b1b53d41SAndrey Ignatov } m_cgroup_storage SEC(".maps"); 503b1b53d41SAndrey Ignatov 504b1b53d41SAndrey Ignatov static inline int check_cgroup_storage(void) 505b1b53d41SAndrey Ignatov { 506b1b53d41SAndrey Ignatov struct bpf_cgroup_storage_map *cgroup_storage = 507b1b53d41SAndrey Ignatov (struct bpf_cgroup_storage_map *)&m_cgroup_storage; 508b1b53d41SAndrey Ignatov struct bpf_map *map = (struct bpf_map *)&m_cgroup_storage; 509b1b53d41SAndrey Ignatov 510b1b53d41SAndrey Ignatov VERIFY(check(&cgroup_storage->map, map, 511b1b53d41SAndrey Ignatov sizeof(struct bpf_cgroup_storage_key), sizeof(__u32), 0)); 512b1b53d41SAndrey Ignatov 513b1b53d41SAndrey Ignatov return 1; 514b1b53d41SAndrey Ignatov } 515b1b53d41SAndrey Ignatov 516b1b53d41SAndrey Ignatov struct reuseport_array { 517b1b53d41SAndrey Ignatov struct bpf_map map; 518b1b53d41SAndrey Ignatov } __attribute__((preserve_access_index)); 519b1b53d41SAndrey Ignatov 520b1b53d41SAndrey Ignatov struct { 521b1b53d41SAndrey Ignatov __uint(type, BPF_MAP_TYPE_REUSEPORT_SOCKARRAY); 522b1b53d41SAndrey Ignatov __uint(max_entries, MAX_ENTRIES); 523b1b53d41SAndrey Ignatov __type(key, __u32); 524b1b53d41SAndrey Ignatov __type(value, __u32); 525b1b53d41SAndrey Ignatov } m_reuseport_sockarray SEC(".maps"); 526b1b53d41SAndrey Ignatov 527b1b53d41SAndrey Ignatov static inline int check_reuseport_sockarray(void) 528b1b53d41SAndrey Ignatov { 529b1b53d41SAndrey Ignatov struct reuseport_array *reuseport_sockarray = 530b1b53d41SAndrey Ignatov (struct reuseport_array *)&m_reuseport_sockarray; 531b1b53d41SAndrey Ignatov struct bpf_map *map = (struct bpf_map *)&m_reuseport_sockarray; 532b1b53d41SAndrey Ignatov 533b1b53d41SAndrey Ignatov VERIFY(check_default(&reuseport_sockarray->map, map)); 534b1b53d41SAndrey Ignatov 535b1b53d41SAndrey Ignatov return 1; 536b1b53d41SAndrey Ignatov } 537b1b53d41SAndrey Ignatov 538b1b53d41SAndrey Ignatov struct { 539b1b53d41SAndrey Ignatov __uint(type, BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE); 540b1b53d41SAndrey Ignatov __type(key, struct bpf_cgroup_storage_key); 541b1b53d41SAndrey Ignatov __type(value, __u32); 542b1b53d41SAndrey Ignatov } m_percpu_cgroup_storage SEC(".maps"); 543b1b53d41SAndrey Ignatov 544b1b53d41SAndrey Ignatov static inline int check_percpu_cgroup_storage(void) 545b1b53d41SAndrey Ignatov { 546b1b53d41SAndrey Ignatov struct bpf_cgroup_storage_map *percpu_cgroup_storage = 547b1b53d41SAndrey Ignatov (struct bpf_cgroup_storage_map *)&m_percpu_cgroup_storage; 548b1b53d41SAndrey Ignatov struct bpf_map *map = (struct bpf_map *)&m_percpu_cgroup_storage; 549b1b53d41SAndrey Ignatov 550b1b53d41SAndrey Ignatov VERIFY(check(&percpu_cgroup_storage->map, map, 551b1b53d41SAndrey Ignatov sizeof(struct bpf_cgroup_storage_key), sizeof(__u32), 0)); 552b1b53d41SAndrey Ignatov 553b1b53d41SAndrey Ignatov return 1; 554b1b53d41SAndrey Ignatov } 555b1b53d41SAndrey Ignatov 556b1b53d41SAndrey Ignatov struct bpf_queue_stack { 557b1b53d41SAndrey Ignatov struct bpf_map map; 558b1b53d41SAndrey Ignatov } __attribute__((preserve_access_index)); 559b1b53d41SAndrey Ignatov 560b1b53d41SAndrey Ignatov struct { 561b1b53d41SAndrey Ignatov __uint(type, BPF_MAP_TYPE_QUEUE); 562b1b53d41SAndrey Ignatov __uint(max_entries, MAX_ENTRIES); 563b1b53d41SAndrey Ignatov __type(value, __u32); 564b1b53d41SAndrey Ignatov } m_queue SEC(".maps"); 565b1b53d41SAndrey Ignatov 566b1b53d41SAndrey Ignatov static inline int check_queue(void) 567b1b53d41SAndrey Ignatov { 568b1b53d41SAndrey Ignatov struct bpf_queue_stack *queue = (struct bpf_queue_stack *)&m_queue; 569b1b53d41SAndrey Ignatov struct bpf_map *map = (struct bpf_map *)&m_queue; 570b1b53d41SAndrey Ignatov 571b1b53d41SAndrey Ignatov VERIFY(check(&queue->map, map, 0, sizeof(__u32), MAX_ENTRIES)); 572b1b53d41SAndrey Ignatov 573b1b53d41SAndrey Ignatov return 1; 574b1b53d41SAndrey Ignatov } 575b1b53d41SAndrey Ignatov 576b1b53d41SAndrey Ignatov struct { 577b1b53d41SAndrey Ignatov __uint(type, BPF_MAP_TYPE_STACK); 578b1b53d41SAndrey Ignatov __uint(max_entries, MAX_ENTRIES); 579b1b53d41SAndrey Ignatov __type(value, __u32); 580b1b53d41SAndrey Ignatov } m_stack SEC(".maps"); 581b1b53d41SAndrey Ignatov 582b1b53d41SAndrey Ignatov static inline int check_stack(void) 583b1b53d41SAndrey Ignatov { 584b1b53d41SAndrey Ignatov struct bpf_queue_stack *stack = (struct bpf_queue_stack *)&m_stack; 585b1b53d41SAndrey Ignatov struct bpf_map *map = (struct bpf_map *)&m_stack; 586b1b53d41SAndrey Ignatov 587b1b53d41SAndrey Ignatov VERIFY(check(&stack->map, map, 0, sizeof(__u32), MAX_ENTRIES)); 588b1b53d41SAndrey Ignatov 589b1b53d41SAndrey Ignatov return 1; 590b1b53d41SAndrey Ignatov } 591b1b53d41SAndrey Ignatov 5921f00d375SKP Singh struct bpf_local_storage_map { 593b1b53d41SAndrey Ignatov struct bpf_map map; 594b1b53d41SAndrey Ignatov } __attribute__((preserve_access_index)); 595b1b53d41SAndrey Ignatov 596b1b53d41SAndrey Ignatov struct { 597b1b53d41SAndrey Ignatov __uint(type, BPF_MAP_TYPE_SK_STORAGE); 598b1b53d41SAndrey Ignatov __uint(map_flags, BPF_F_NO_PREALLOC); 599b1b53d41SAndrey Ignatov __type(key, __u32); 600b1b53d41SAndrey Ignatov __type(value, __u32); 601b1b53d41SAndrey Ignatov } m_sk_storage SEC(".maps"); 602b1b53d41SAndrey Ignatov 603b1b53d41SAndrey Ignatov static inline int check_sk_storage(void) 604b1b53d41SAndrey Ignatov { 6051f00d375SKP Singh struct bpf_local_storage_map *sk_storage = 6061f00d375SKP Singh (struct bpf_local_storage_map *)&m_sk_storage; 607b1b53d41SAndrey Ignatov struct bpf_map *map = (struct bpf_map *)&m_sk_storage; 608b1b53d41SAndrey Ignatov 609b1b53d41SAndrey Ignatov VERIFY(check(&sk_storage->map, map, sizeof(__u32), sizeof(__u32), 0)); 610b1b53d41SAndrey Ignatov 611b1b53d41SAndrey Ignatov return 1; 612b1b53d41SAndrey Ignatov } 613b1b53d41SAndrey Ignatov 614b1b53d41SAndrey Ignatov struct { 615b1b53d41SAndrey Ignatov __uint(type, BPF_MAP_TYPE_DEVMAP_HASH); 616b1b53d41SAndrey Ignatov __uint(max_entries, MAX_ENTRIES); 617b1b53d41SAndrey Ignatov __type(key, __u32); 618b1b53d41SAndrey Ignatov __type(value, __u32); 619b1b53d41SAndrey Ignatov } m_devmap_hash SEC(".maps"); 620b1b53d41SAndrey Ignatov 621b1b53d41SAndrey Ignatov static inline int check_devmap_hash(void) 622b1b53d41SAndrey Ignatov { 623b1b53d41SAndrey Ignatov struct bpf_dtab *devmap_hash = (struct bpf_dtab *)&m_devmap_hash; 624b1b53d41SAndrey Ignatov struct bpf_map *map = (struct bpf_map *)&m_devmap_hash; 625b1b53d41SAndrey Ignatov 626b1b53d41SAndrey Ignatov VERIFY(check_default(&devmap_hash->map, map)); 627b1b53d41SAndrey Ignatov 628b1b53d41SAndrey Ignatov return 1; 629b1b53d41SAndrey Ignatov } 630b1b53d41SAndrey Ignatov 631b1b53d41SAndrey Ignatov struct bpf_ringbuf_map { 632b1b53d41SAndrey Ignatov struct bpf_map map; 633b1b53d41SAndrey Ignatov } __attribute__((preserve_access_index)); 634b1b53d41SAndrey Ignatov 635b1b53d41SAndrey Ignatov struct { 636b1b53d41SAndrey Ignatov __uint(type, BPF_MAP_TYPE_RINGBUF); 637b1b53d41SAndrey Ignatov __uint(max_entries, 1 << 12); 638b1b53d41SAndrey Ignatov } m_ringbuf SEC(".maps"); 639b1b53d41SAndrey Ignatov 640b1b53d41SAndrey Ignatov static inline int check_ringbuf(void) 641b1b53d41SAndrey Ignatov { 642b1b53d41SAndrey Ignatov struct bpf_ringbuf_map *ringbuf = (struct bpf_ringbuf_map *)&m_ringbuf; 643b1b53d41SAndrey Ignatov struct bpf_map *map = (struct bpf_map *)&m_ringbuf; 644b1b53d41SAndrey Ignatov 645b1b53d41SAndrey Ignatov VERIFY(check(&ringbuf->map, map, 0, 0, 1 << 12)); 646b1b53d41SAndrey Ignatov 647b1b53d41SAndrey Ignatov return 1; 648b1b53d41SAndrey Ignatov } 649b1b53d41SAndrey Ignatov 650b1b53d41SAndrey Ignatov SEC("cgroup_skb/egress") 651b1b53d41SAndrey Ignatov int cg_skb(void *ctx) 652b1b53d41SAndrey Ignatov { 653b1b53d41SAndrey Ignatov VERIFY_TYPE(BPF_MAP_TYPE_HASH, check_hash); 654b1b53d41SAndrey Ignatov VERIFY_TYPE(BPF_MAP_TYPE_ARRAY, check_array); 655b1b53d41SAndrey Ignatov VERIFY_TYPE(BPF_MAP_TYPE_PROG_ARRAY, check_prog_array); 656b1b53d41SAndrey Ignatov VERIFY_TYPE(BPF_MAP_TYPE_PERF_EVENT_ARRAY, check_perf_event_array); 657b1b53d41SAndrey Ignatov VERIFY_TYPE(BPF_MAP_TYPE_PERCPU_HASH, check_percpu_hash); 658b1b53d41SAndrey Ignatov VERIFY_TYPE(BPF_MAP_TYPE_PERCPU_ARRAY, check_percpu_array); 659b1b53d41SAndrey Ignatov VERIFY_TYPE(BPF_MAP_TYPE_STACK_TRACE, check_stack_trace); 660b1b53d41SAndrey Ignatov VERIFY_TYPE(BPF_MAP_TYPE_CGROUP_ARRAY, check_cgroup_array); 661b1b53d41SAndrey Ignatov VERIFY_TYPE(BPF_MAP_TYPE_LRU_HASH, check_lru_hash); 662b1b53d41SAndrey Ignatov VERIFY_TYPE(BPF_MAP_TYPE_LRU_PERCPU_HASH, check_lru_percpu_hash); 663b1b53d41SAndrey Ignatov VERIFY_TYPE(BPF_MAP_TYPE_LPM_TRIE, check_lpm_trie); 664b1b53d41SAndrey Ignatov VERIFY_TYPE(BPF_MAP_TYPE_ARRAY_OF_MAPS, check_array_of_maps); 665b1b53d41SAndrey Ignatov VERIFY_TYPE(BPF_MAP_TYPE_HASH_OF_MAPS, check_hash_of_maps); 666b1b53d41SAndrey Ignatov VERIFY_TYPE(BPF_MAP_TYPE_DEVMAP, check_devmap); 667b1b53d41SAndrey Ignatov VERIFY_TYPE(BPF_MAP_TYPE_SOCKMAP, check_sockmap); 668b1b53d41SAndrey Ignatov VERIFY_TYPE(BPF_MAP_TYPE_CPUMAP, check_cpumap); 669b1b53d41SAndrey Ignatov VERIFY_TYPE(BPF_MAP_TYPE_XSKMAP, check_xskmap); 670b1b53d41SAndrey Ignatov VERIFY_TYPE(BPF_MAP_TYPE_SOCKHASH, check_sockhash); 671b1b53d41SAndrey Ignatov VERIFY_TYPE(BPF_MAP_TYPE_CGROUP_STORAGE, check_cgroup_storage); 672b1b53d41SAndrey Ignatov VERIFY_TYPE(BPF_MAP_TYPE_REUSEPORT_SOCKARRAY, 673b1b53d41SAndrey Ignatov check_reuseport_sockarray); 674b1b53d41SAndrey Ignatov VERIFY_TYPE(BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE, 675b1b53d41SAndrey Ignatov check_percpu_cgroup_storage); 676b1b53d41SAndrey Ignatov VERIFY_TYPE(BPF_MAP_TYPE_QUEUE, check_queue); 677b1b53d41SAndrey Ignatov VERIFY_TYPE(BPF_MAP_TYPE_STACK, check_stack); 678b1b53d41SAndrey Ignatov VERIFY_TYPE(BPF_MAP_TYPE_SK_STORAGE, check_sk_storage); 679b1b53d41SAndrey Ignatov VERIFY_TYPE(BPF_MAP_TYPE_DEVMAP_HASH, check_devmap_hash); 680b1b53d41SAndrey Ignatov VERIFY_TYPE(BPF_MAP_TYPE_RINGBUF, check_ringbuf); 681b1b53d41SAndrey Ignatov 682b1b53d41SAndrey Ignatov return 1; 683b1b53d41SAndrey Ignatov } 684b1b53d41SAndrey Ignatov 685b1b53d41SAndrey Ignatov __u32 _version SEC("version") = 1; 686b1b53d41SAndrey Ignatov char _license[] SEC("license") = "GPL"; 687