xref: /linux/tools/testing/selftests/bpf/progs/uptr_map_failure.c (revision fcc79e1714e8c2b8e216dc3149812edd37884eef)
1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright (c) 2024 Meta Platforms, Inc. and affiliates. */
3 
4 #include <vmlinux.h>
5 #include <bpf/bpf_helpers.h>
6 #include "uptr_test_common.h"
7 
8 struct {
9 	__uint(type, BPF_MAP_TYPE_TASK_STORAGE);
10 	__uint(map_flags, BPF_F_NO_PREALLOC);
11 	__type(key, int);
12 	__type(value, struct large_uptr);
13 } large_uptr_map SEC(".maps");
14 
15 struct {
16 	__uint(type, BPF_MAP_TYPE_TASK_STORAGE);
17 	__uint(map_flags, BPF_F_NO_PREALLOC);
18 	__type(key, int);
19 	__type(value, struct empty_uptr);
20 } empty_uptr_map SEC(".maps");
21 
22 struct {
23 	__uint(type, BPF_MAP_TYPE_TASK_STORAGE);
24 	__uint(map_flags, BPF_F_NO_PREALLOC);
25 	__type(key, int);
26 	__type(value, struct kstruct_uptr);
27 } kstruct_uptr_map SEC(".maps");
28