Commit 8981e56f authored by Andrii Nakryiko's avatar Andrii Nakryiko Committed by Daniel Borkmann

selftests/bpf: use typedef'ed arrays as map values

Convert few tests that couldn't use typedef'ed arrays due to kernel bug.
Signed-off-by: default avatarAndrii Nakryiko <andriin@fb.com>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
parent dd13f3ca
...@@ -47,11 +47,12 @@ struct { ...@@ -47,11 +47,12 @@ struct {
* issue and avoid complicated C programming massaging. * issue and avoid complicated C programming massaging.
* This is an acceptable workaround since there is one entry here. * This is an acceptable workaround since there is one entry here.
*/ */
typedef __u64 raw_stack_trace_t[2 * MAX_STACK_RAWTP];
struct { struct {
__uint(type, BPF_MAP_TYPE_PERCPU_ARRAY); __uint(type, BPF_MAP_TYPE_PERCPU_ARRAY);
__uint(max_entries, 1); __uint(max_entries, 1);
__type(key, __u32); __type(key, __u32);
__u64 (*value)[2 * MAX_STACK_RAWTP]; __type(value, raw_stack_trace_t);
} rawdata_map SEC(".maps"); } rawdata_map SEC(".maps");
SEC("tracepoint/raw_syscalls/sys_enter") SEC("tracepoint/raw_syscalls/sys_enter")
......
...@@ -36,8 +36,7 @@ struct { ...@@ -36,8 +36,7 @@ struct {
__uint(type, BPF_MAP_TYPE_ARRAY); __uint(type, BPF_MAP_TYPE_ARRAY);
__uint(max_entries, 128); __uint(max_entries, 128);
__type(key, __u32); __type(key, __u32);
/* there seems to be a bug in kernel not handling typedef properly */ __type(value, stack_trace_t);
struct bpf_stack_build_id (*value)[PERF_MAX_STACK_DEPTH];
} stack_amap SEC(".maps"); } stack_amap SEC(".maps");
/* taken from /sys/kernel/debug/tracing/events/random/urandom_read/format */ /* taken from /sys/kernel/debug/tracing/events/random/urandom_read/format */
......
...@@ -35,7 +35,7 @@ struct { ...@@ -35,7 +35,7 @@ struct {
__uint(type, BPF_MAP_TYPE_ARRAY); __uint(type, BPF_MAP_TYPE_ARRAY);
__uint(max_entries, 16384); __uint(max_entries, 16384);
__type(key, __u32); __type(key, __u32);
__u64 (*value)[PERF_MAX_STACK_DEPTH]; __type(value, stack_trace_t);
} stack_amap SEC(".maps"); } stack_amap SEC(".maps");
/* taken from /sys/kernel/debug/tracing/events/sched/sched_switch/format */ /* taken from /sys/kernel/debug/tracing/events/sched/sched_switch/format */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment