mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-26 03:52:41 +00:00
selftests/bpf: Create task_local_storage map with invalid uptr's struct
This patch tests the map creation failure when the map_value has unsupported uptr. The three cases are the struct is larger than one page, the struct is empty, and the struct is a kernel struct. Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org> Link: https://lore.kernel.org/r/20241023234759.860539-13-martin.lau@linux.dev Signed-off-by: Alexei Starovoitov <ast@kernel.org>
This commit is contained in:
committed by
Alexei Starovoitov
parent
898cbca4a7
commit
bd5879a6fe
@@ -5,9 +5,12 @@
|
||||
#define _UPTR_TEST_COMMON_H
|
||||
|
||||
#define MAGIC_VALUE 0xabcd1234
|
||||
#define PAGE_SIZE 4096
|
||||
|
||||
#ifdef __BPF__
|
||||
/* Avoid fwd btf type being generated for the following struct */
|
||||
struct large_data *dummy_large_data;
|
||||
struct empty_data *dummy_empty_data;
|
||||
struct user_data *dummy_data;
|
||||
struct cgroup *dummy_cgrp;
|
||||
#else
|
||||
@@ -37,4 +40,24 @@ struct value_lock_type {
|
||||
struct bpf_spin_lock lock;
|
||||
};
|
||||
|
||||
struct large_data {
|
||||
__u8 one_page[PAGE_SIZE];
|
||||
int a;
|
||||
};
|
||||
|
||||
struct large_uptr {
|
||||
struct large_data __uptr *udata;
|
||||
};
|
||||
|
||||
struct empty_data {
|
||||
};
|
||||
|
||||
struct empty_uptr {
|
||||
struct empty_data __uptr *udata;
|
||||
};
|
||||
|
||||
struct kstruct_uptr {
|
||||
struct cgroup __uptr *cgrp;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user