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