aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/tools/testing/selftests/bpf/progs/map_ptr_kern.c
blob: efaf622c28ddec5561b2a37c4b5233204ad3dbf8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2020 Facebook

#include <linux/bpf.h>
#include <bpf/bpf_helpers.h>

#define LOOP_BOUND 0xf
#define MAX_ENTRIES 8
#define HALF_ENTRIES (MAX_ENTRIES >> 1)

_Static_assert(MAX_ENTRIES < LOOP_BOUND, "MAX_ENTRIES must be < LOOP_BOUND");

enum bpf_map_type g_map_type = BPF_MAP_TYPE_UNSPEC;
__u32 g_line = 0;
int page_size = 0; /* userspace should set it */

#define VERIFY_TYPE(type, func) ({	\
	g_map_type = type;		\
	if (!func())			\
		return 0;		\
})


#define VERIFY(expr) ({		\
	g_line = __LINE__;	\
	if (!(expr))		\
		return 0;	\
})

struct bpf_map {
	enum bpf_map_type map_type;
	__u32 key_size;
	__u32 value_size;
	__u32 max_entries;
	__u32 id;
} __attribute__((preserve_access_index));

static inline int check_bpf_map_fields(struct bpf_map *map, __u32 key_size,
				       __u32 value_size, __u32 max_entries)
{
	VERIFY(map->map_type == g_map_type);
	VERIFY(map->key_size == key_size);
	VERIFY(map->value_size == value_size);
	VERIFY(map->max_entries == max_entries);
	VERIFY(map->id > 0);

	return 1;
}

static inline int check_bpf_map_ptr(struct bpf_map *indirect,
				    struct bpf_map *direct)
{
	VERIFY(indirect->map_type == direct->map_type);
	VERIFY(indirect->key_size == direct->key_size);
	VERIFY(indirect->value_size == direct->value_size);
	VERIFY(indirect->max_entries == direct->max_entries);
	VERIFY(indirect->id == direct->id);

	return 1;
}

static inline int check(struct bpf_map *indirect, struct bpf_map *direct,
			__u32 key_size, __u32 value_size, __u32 max_entries)
{
	VERIFY(check_bpf_map_ptr(indirect, direct));
	VERIFY(check_bpf_map_fields(indirect, key_size, value_size,
				    max_entries));
	return 1;
}

static inline int check_default(struct bpf_map *indirect,
				struct bpf_map *direct)
{
	VERIFY(check(indirect, direct, sizeof(__u32), sizeof(__u32),
		     MAX_ENTRIES));
	return 1;
}

static __noinline int
check_default_noinline(struct bpf_map *indirect, struct bpf_map *direct)
{
	VERIFY(check(indirect, direct, sizeof(__u32), sizeof(__u32),
		     MAX_ENTRIES));
	return 1;
}

typedef struct {
	int counter;
} atomic_t;

struct bpf_htab {
	struct bpf_map map;
	atomic_t count;
	__u32 n_buckets;
	__u32 elem_size;
} __attribute__((preserve_access_index));

struct {
	__uint(type, BPF_MAP_TYPE_HASH);
	__uint(map_flags, BPF_F_NO_PREALLOC); /* to test bpf_htab.count */
	__uint(max_entries, MAX_ENTRIES);
	__type(key, __u32);
	__type(value, __u32);
} m_hash SEC(".maps");

__s64 bpf_map_sum_elem_count(struct bpf_map *map) __ksym;

static inline int check_hash(void)
{
	struct bpf_htab *hash = (struct bpf_htab *)&m_hash;
	struct bpf_map *map = (struct bpf_map *)&m_hash;
	int i;

	VERIFY(check_default_noinline(&hash->map, map));

	VERIFY(hash->n_buckets == MAX_ENTRIES);
	VERIFY(hash->elem_size == 64);

	VERIFY(hash->count.counter == 0);
	VERIFY(bpf_map_sum_elem_count(map) == 0);

	for (i = 0; i < HALF_ENTRIES; ++i) {
		const __u32 key = i;
		const __u32 val = 1;

		if (bpf_map_update_elem(hash, &key, &val, 0))
			return 0;
	}
	VERIFY(hash->count.counter == HALF_ENTRIES);
	VERIFY(bpf_map_sum_elem_count(map) == HALF_ENTRIES);

	return 1;
}

struct bpf_array {
	struct bpf_map map;
	__u32 elem_size;
} __attribute__((preserve_access_index));

struct {
	__uint(type, BPF_MAP_TYPE_ARRAY);
	__uint(max_entries, MAX_ENTRIES);
	__type(key, __u32);
	__type(value, __u32);
} m_array SEC(".maps");

static inline int check_array(void)
{
	struct bpf_array *array = (struct bpf_array *)&m_array;
	struct bpf_map *map = (struct bpf_map *)&m_array;
	int i, n_lookups = 0, n_keys = 0;

	VERIFY(check_default(&array->map, map));

	VERIFY(array->elem_size == 8);

	for (i = 0; i < array->map.max_entries && i < LOOP_BOUND; ++i) {
		const __u32 key = i;
		__u32 *val = bpf_map_lookup_elem(array, &key);

		++n_lookups;
		if (val)
			++n_keys;
	}

	VERIFY(n_lookups == MAX_ENTRIES);
	VERIFY(n_keys == MAX_ENTRIES);

	return 1;
}

struct {
	__uint(type, BPF_MAP_TYPE_PROG_ARRAY);
	__uint(max_entries, MAX_ENTRIES);
	__type(key, __u32);
	__type(value, __u32);
} m_prog_array SEC(".maps");

static inline int check_prog_array(void)
{
	struct bpf_array *prog_array = (struct bpf_array *)&m_prog_array;
	struct bpf_map *map = (struct bpf_map *)&m_prog_array;

	VERIFY(check_default(&prog_array->map, map));

	return 1;
}

struct {
	__uint(type, BPF_MAP_TYPE_PERF_EVENT_ARRAY);
	__uint(max_entries, MAX_ENTRIES);
	__type(key, __u32);
	__type(value, __u32);
} m_perf_event_array SEC(".maps");

static inline int check_perf_event_array(void)
{
	struct bpf_array *perf_event_array = (struct bpf_array *)&m_perf_event_array;
	struct bpf_map *map = (struct bpf_map *)&m_perf_event_array;

	VERIFY(check_default(&perf_event_array->map, map));

	return 1;
}

struct {
	__uint(type, BPF_MAP_TYPE_PERCPU_HASH);
	__uint(max_entries, MAX_ENTRIES);
	__type(key, __u32);
	__type(value, __u32);
} m_percpu_hash SEC(".maps");

static inline int check_percpu_hash(void)
{
	struct bpf_htab *percpu_hash = (struct bpf_htab *)&m_percpu_hash;
	struct bpf_map *map = (struct bpf_map *)&m_percpu_hash;

	VERIFY(check_default(&percpu_hash->map, map));

	return 1;
}

struct {
	__uint(type, BPF_MAP_TYPE_PERCPU_ARRAY);
	__uint(max_entries, MAX_ENTRIES);
	__type(key, __u32);
	__type(value, __u32);
} m_percpu_array SEC(".maps");

static inline int check_percpu_array(void)
{
	struct bpf_array *percpu_array = (struct bpf_array *)&m_percpu_array;
	struct bpf_map *map = (struct bpf_map *)&m_percpu_array;

	VERIFY(check_default(&percpu_array->map, map));

	return 1;
}

struct bpf_stack_map {
	struct bpf_map map;
} __attribute__((preserve_access_index));

struct {
	__uint(type, BPF_MAP_TYPE_STACK_TRACE);
	__uint(max_entries, MAX_ENTRIES);
	__type(key, __u32);
	__type(value, __u64);
} m_stack_trace SEC(".maps");

static inline int check_stack_trace(void)
{
	struct bpf_stack_map *stack_trace =
		(struct bpf_stack_map *)&m_stack_trace;
	struct bpf_map *map = (struct bpf_map *)&m_stack_trace;

	VERIFY(check(&stack_trace->map, map, sizeof(__u32), sizeof(__u64),
		     MAX_ENTRIES));

	return 1;
}

struct {
	__uint(type, BPF_MAP_TYPE_CGROUP_ARRAY);
	__uint(max_entries, MAX_ENTRIES);
	__type(key, __u32);
	__type(value, __u32);
} m_cgroup_array SEC(".maps");

static inline int check_cgroup_array(void)
{
	struct bpf_array *cgroup_array = (struct bpf_array *)&m_cgroup_array;
	struct bpf_map *map = (struct bpf_map *)&m_cgroup_array;

	VERIFY(check_default(&cgroup_array->map, map));

	return 1;
}

struct {
	__uint(type, BPF_MAP_TYPE_LRU_HASH);
	__uint(max_entries, MAX_ENTRIES);
	__type(key, __u32);
	__type(value, __u32);
} m_lru_hash SEC(".maps");

static inline int check_lru_hash(void)
{
	struct bpf_htab *lru_hash = (struct bpf_htab *)&m_lru_hash;
	struct bpf_map *map = (struct bpf_map *)&m_lru_hash;

	VERIFY(check_default(&lru_hash->map, map));

	return 1;
}

struct {
	__uint(type, BPF_MAP_TYPE_LRU_PERCPU_HASH);
	__uint(max_entries, MAX_ENTRIES);
	__type(key, __u32);
	__type(value, __u32);
} m_lru_percpu_hash SEC(".maps");

static inline int check_lru_percpu_hash(void)
{
	struct bpf_htab *lru_percpu_hash = (struct bpf_htab *)&m_lru_percpu_hash;
	struct bpf_map *map = (struct bpf_map *)&m_lru_percpu_hash;

	VERIFY(check_default(&lru_percpu_hash->map, map));

	return 1;
}

struct lpm_trie {
	struct bpf_map map;
} __attribute__((preserve_access_index));

struct lpm_key {
	struct bpf_lpm_trie_key_hdr trie_key;
	__u32 data;
};

struct {
	__uint(type, BPF_MAP_TYPE_LPM_TRIE);
	__uint(map_flags, BPF_F_NO_PREALLOC);
	__uint(max_entries, MAX_ENTRIES);
	__type(key, struct lpm_key);
	__type(value, __u32);
} m_lpm_trie SEC(".maps");

static inline int check_lpm_trie(void)
{
	struct lpm_trie *lpm_trie = (struct lpm_trie *)&m_lpm_trie;
	struct bpf_map *map = (struct bpf_map *)&m_lpm_trie;

	VERIFY(check(&lpm_trie->map, map, sizeof(struct lpm_key), sizeof(__u32),
		     MAX_ENTRIES));

	return 1;
}

#define INNER_MAX_ENTRIES 1234

struct inner_map {
	__uint(type, BPF_MAP_TYPE_ARRAY);
	__uint(max_entries, INNER_MAX_ENTRIES);
	__type(key, __u32);
	__type(value, __u32);
} inner_map SEC(".maps");

struct {
	__uint(type, BPF_MAP_TYPE_ARRAY_OF_MAPS);
	__uint(max_entries, MAX_ENTRIES);
	__type(key, __u32);
	__type(value, __u32);
	__array(values, struct {
		__uint(type, BPF_MAP_TYPE_ARRAY);
		__uint(max_entries, INNER_MAX_ENTRIES);
		__type(key, __u32);
		__type(value, __u32);
	});
} m_array_of_maps SEC(".maps") = {
	.values = { (void *)&inner_map, 0, 0, 0, 0, 0, 0, 0, 0 },
};

static inline int check_array_of_maps(void)
{
	struct bpf_array *array_of_maps = (struct bpf_array *)&m_array_of_maps;
	struct bpf_map *map = (struct bpf_map *)&m_array_of_maps;
	struct bpf_array *inner_map;
	int key = 0;

	VERIFY(check_default(&array_of_maps->map, map));
	inner_map = bpf_map_lookup_elem(array_of_maps, &key);
	VERIFY(inner_map != NULL);
	VERIFY(inner_map->map.max_entries == INNER_MAX_ENTRIES);

	return 1;
}

struct {
	__uint(type, BPF_MAP_TYPE_HASH_OF_MAPS);
	__uint(max_entries, MAX_ENTRIES);
	__type(key, __u32);
	__type(value, __u32);
	__array(values, struct inner_map);
} m_hash_of_maps SEC(".maps") = {
	.values = {
		[2] = &inner_map,
	},
};

static inline int check_hash_of_maps(void)
{
	struct bpf_htab *hash_of_maps = (struct bpf_htab *)&m_hash_of_maps;
	struct bpf_map *map = (struct bpf_map *)&m_hash_of_maps;
	struct bpf_htab *inner_map;
	int key = 2;

	VERIFY(check_default(&hash_of_maps->map, map));
	inner_map = bpf_map_lookup_elem(hash_of_maps, &key);
	VERIFY(inner_map != NULL);
	VERIFY(inner_map->map.max_entries == INNER_MAX_ENTRIES);

	return 1;
}

struct bpf_dtab {
	struct bpf_map map;
} __attribute__((preserve_access_index));

struct {
	__uint(type, BPF_MAP_TYPE_DEVMAP);
	__uint(max_entries, MAX_ENTRIES);
	__type(key, __u32);
	__type(value, __u32);
} m_devmap SEC(".maps");

static inline int check_devmap(void)
{
	struct bpf_dtab *devmap = (struct bpf_dtab *)&m_devmap;
	struct bpf_map *map = (struct bpf_map *)&m_devmap;

	VERIFY(check_default(&devmap->map, map));

	return 1;
}

struct bpf_stab {
	struct bpf_map map;
} __attribute__((preserve_access_index));

struct {
	__uint(type, BPF_MAP_TYPE_SOCKMAP);
	__uint(max_entries, MAX_ENTRIES);
	__type(key, __u32);
	__type(value, __u32);
} m_sockmap SEC(".maps");

static inline int check_sockmap(void)
{
	struct bpf_stab *sockmap = (struct bpf_stab *)&m_sockmap;
	struct bpf_map *map = (struct bpf_map *)&m_sockmap;

	VERIFY(check_default(&sockmap->map, map));

	return 1;
}

struct bpf_cpu_map {
	struct bpf_map map;
} __attribute__((preserve_access_index));

struct {
	__uint(type, BPF_MAP_TYPE_CPUMAP);
	__uint(max_entries, MAX_ENTRIES);
	__type(key, __u32);
	__type(value, __u32);
} m_cpumap SEC(".maps");

static inline int check_cpumap(void)
{
	struct bpf_cpu_map *cpumap = (struct bpf_cpu_map *)&m_cpumap;
	struct bpf_map *map = (struct bpf_map *)&m_cpumap;

	VERIFY(check_default(&cpumap->map, map));

	return 1;
}

struct xsk_map {
	struct bpf_map map;
} __attribute__((preserve_access_index));

struct {
	__uint(type, BPF_MAP_TYPE_XSKMAP);
	__uint(max_entries, MAX_ENTRIES);
	__type(key, __u32);
	__type(value, __u32);
} m_xskmap SEC(".maps");

static inline int check_xskmap(void)
{
	struct xsk_map *xskmap = (struct xsk_map *)&m_xskmap;
	struct bpf_map *map = (struct bpf_map *)&m_xskmap;

	VERIFY(check_default(&xskmap->map, map));

	return 1;
}

struct bpf_shtab {
	struct bpf_map map;
} __attribute__((preserve_access_index));

struct {
	__uint(type, BPF_MAP_TYPE_SOCKHASH);
	__uint(max_entries, MAX_ENTRIES);
	__type(key, __u32);
	__type(value, __u32);
} m_sockhash SEC(".maps");

static inline int check_sockhash(void)
{
	struct bpf_shtab *sockhash = (struct bpf_shtab *)&m_sockhash;
	struct bpf_map *map = (struct bpf_map *)&m_sockhash;

	VERIFY(check_default(&sockhash->map, map));

	return 1;
}

struct bpf_cgroup_storage_map {
	struct bpf_map map;
} __attribute__((preserve_access_index));

struct {
	__uint(type, BPF_MAP_TYPE_CGROUP_STORAGE);
	__type(key, struct bpf_cgroup_storage_key);
	__type(value, __u32);
} m_cgroup_storage SEC(".maps");

static inline int check_cgroup_storage(void)
{
	struct bpf_cgroup_storage_map *cgroup_storage =
		(struct bpf_cgroup_storage_map *)&m_cgroup_storage;
	struct bpf_map *map = (struct bpf_map *)&m_cgroup_storage;

	VERIFY(check(&cgroup_storage->map, map,
		     sizeof(struct bpf_cgroup_storage_key), sizeof(__u32), 0));

	return 1;
}

struct reuseport_array {
	struct bpf_map map;
} __attribute__((preserve_access_index));

struct {
	__uint(type, BPF_MAP_TYPE_REUSEPORT_SOCKARRAY);
	__uint(max_entries, MAX_ENTRIES);
	__type(key, __u32);
	__type(value, __u32);
} m_reuseport_sockarray SEC(".maps");

static inline int check_reuseport_sockarray(void)
{
	struct reuseport_array *reuseport_sockarray =
		(struct reuseport_array *)&m_reuseport_sockarray;
	struct bpf_map *map = (struct bpf_map *)&m_reuseport_sockarray;

	VERIFY(check_default(&reuseport_sockarray->map, map));

	return 1;
}

struct {
	__uint(type, BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE);
	__type(key, struct bpf_cgroup_storage_key);
	__type(value, __u32);
} m_percpu_cgroup_storage SEC(".maps");

static inline int check_percpu_cgroup_storage(void)
{
	struct bpf_cgroup_storage_map *percpu_cgroup_storage =
		(struct bpf_cgroup_storage_map *)&m_percpu_cgroup_storage;
	struct bpf_map *map = (struct bpf_map *)&m_percpu_cgroup_storage;

	VERIFY(check(&percpu_cgroup_storage->map, map,
		     sizeof(struct bpf_cgroup_storage_key), sizeof(__u32), 0));

	return 1;
}

struct bpf_queue_stack {
	struct bpf_map map;
} __attribute__((preserve_access_index));

struct {
	__uint(type, BPF_MAP_TYPE_QUEUE);
	__uint(max_entries, MAX_ENTRIES);
	__type(value, __u32);
} m_queue SEC(".maps");

static inline int check_queue(void)
{
	struct bpf_queue_stack *queue = (struct bpf_queue_stack *)&m_queue;
	struct bpf_map *map = (struct bpf_map *)&m_queue;

	VERIFY(check(&queue->map, map, 0, sizeof(__u32), MAX_ENTRIES));

	return 1;
}

struct {
	__uint(type, BPF_MAP_TYPE_STACK);
	__uint(max_entries, MAX_ENTRIES);
	__type(value, __u32);
} m_stack SEC(".maps");

static inline int check_stack(void)
{
	struct bpf_queue_stack *stack = (struct bpf_queue_stack *)&m_stack;
	struct bpf_map *map = (struct bpf_map *)&m_stack;

	VERIFY(check(&stack->map, map, 0, sizeof(__u32), MAX_ENTRIES));

	return 1;
}

struct bpf_local_storage_map {
	struct bpf_map map;
} __attribute__((preserve_access_index));

struct {
	__uint(type, BPF_MAP_TYPE_SK_STORAGE);
	__uint(map_flags, BPF_F_NO_PREALLOC);
	__type(key, __u32);
	__type(value, __u32);
} m_sk_storage SEC(".maps");

static inline int check_sk_storage(void)
{
	struct bpf_local_storage_map *sk_storage =
		(struct bpf_local_storage_map *)&m_sk_storage;
	struct bpf_map *map = (struct bpf_map *)&m_sk_storage;

	VERIFY(check(&sk_storage->map, map, sizeof(__u32), sizeof(__u32), 0));

	return 1;
}

struct {
	__uint(type, BPF_MAP_TYPE_DEVMAP_HASH);
	__uint(max_entries, MAX_ENTRIES);
	__type(key, __u32);
	__type(value, __u32);
} m_devmap_hash SEC(".maps");

static inline int check_devmap_hash(void)
{
	struct bpf_dtab *devmap_hash = (struct bpf_dtab *)&m_devmap_hash;
	struct bpf_map *map = (struct bpf_map *)&m_devmap_hash;

	VERIFY(check_default(&devmap_hash->map, map));

	return 1;
}

struct bpf_ringbuf_map {
	struct bpf_map map;
} __attribute__((preserve_access_index));

struct {
	__uint(type, BPF_MAP_TYPE_RINGBUF);
} m_ringbuf SEC(".maps");

static inline int check_ringbuf(void)
{
	struct bpf_ringbuf_map *ringbuf = (struct bpf_ringbuf_map *)&m_ringbuf;
	struct bpf_map *map = (struct bpf_map *)&m_ringbuf;

	VERIFY(check(&ringbuf->map, map, 0, 0, page_size));

	return 1;
}

SEC("cgroup_skb/egress")
int cg_skb(void *ctx)
{
	VERIFY_TYPE(BPF_MAP_TYPE_HASH, check_hash);
	VERIFY_TYPE(BPF_MAP_TYPE_ARRAY, check_array);
	VERIFY_TYPE(BPF_MAP_TYPE_PROG_ARRAY, check_prog_array);
	VERIFY_TYPE(BPF_MAP_TYPE_PERF_EVENT_ARRAY, check_perf_event_array);
	VERIFY_TYPE(BPF_MAP_TYPE_PERCPU_HASH, check_percpu_hash);
	VERIFY_TYPE(BPF_MAP_TYPE_PERCPU_ARRAY, check_percpu_array);
	VERIFY_TYPE(BPF_MAP_TYPE_STACK_TRACE, check_stack_trace);
	VERIFY_TYPE(BPF_MAP_TYPE_CGROUP_ARRAY, check_cgroup_array);
	VERIFY_TYPE(BPF_MAP_TYPE_LRU_HASH, check_lru_hash);
	VERIFY_TYPE(BPF_MAP_TYPE_LRU_PERCPU_HASH, check_lru_percpu_hash);
	VERIFY_TYPE(BPF_MAP_TYPE_LPM_TRIE, check_lpm_trie);
	VERIFY_TYPE(BPF_MAP_TYPE_ARRAY_OF_MAPS, check_array_of_maps);
	VERIFY_TYPE(BPF_MAP_TYPE_HASH_OF_MAPS, check_hash_of_maps);
	VERIFY_TYPE(BPF_MAP_TYPE_DEVMAP, check_devmap);
	VERIFY_TYPE(BPF_MAP_TYPE_SOCKMAP, check_sockmap);
	VERIFY_TYPE(BPF_MAP_TYPE_CPUMAP, check_cpumap);
	VERIFY_TYPE(BPF_MAP_TYPE_XSKMAP, check_xskmap);
	VERIFY_TYPE(BPF_MAP_TYPE_SOCKHASH, check_sockhash);
	VERIFY_TYPE(BPF_MAP_TYPE_CGROUP_STORAGE, check_cgroup_storage);
	VERIFY_TYPE(BPF_MAP_TYPE_REUSEPORT_SOCKARRAY,
		    check_reuseport_sockarray);
	VERIFY_TYPE(BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE,
		    check_percpu_cgroup_storage);
	VERIFY_TYPE(BPF_MAP_TYPE_QUEUE, check_queue);
	VERIFY_TYPE(BPF_MAP_TYPE_STACK, check_stack);
	VERIFY_TYPE(BPF_MAP_TYPE_SK_STORAGE, check_sk_storage);
	VERIFY_TYPE(BPF_MAP_TYPE_DEVMAP_HASH, check_devmap_hash);
	VERIFY_TYPE(BPF_MAP_TYPE_RINGBUF, check_ringbuf);

	return 1;
}

char _license[] SEC("license") = "GPL";