-
Notifications
You must be signed in to change notification settings - Fork 364
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tetragon: Add tests for user (not owner) maps
Adding tests for 'user' maps to cover following scenarios: - user map gets properly created from pinned map - user map fails to be loaded if the pinned map is missing - user map fails to be loaded if the pinned map has different max entries setup - user map fails to be loaded if the pinned map is not compatible Signed-off-by: Jiri Olsa <[email protected]>
- Loading branch information
Showing
3 changed files
with
204 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) | ||
/* Copyright Authors of Cilium */ | ||
|
||
#include "vmlinux.h" | ||
#include "api.h" | ||
#include "bpf_tracing.h" | ||
#include "bpf_helpers.h" | ||
#include "compiler.h" | ||
|
||
struct { | ||
__uint(type, BPF_MAP_TYPE_HASH); | ||
__uint(max_entries, 1); | ||
__type(key, int); | ||
__type(value, unsigned long); | ||
} m1 SEC(".maps"); | ||
|
||
__attribute__((section("kprobe/wake_up_new_task"), used)) int | ||
BPF_KPROBE(p2) | ||
{ | ||
map_lookup_elem(&m1, &(unsigned long){ 0 }); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters