-
Notifications
You must be signed in to change notification settings - Fork 310
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
uprobe-stress: add uprobe stress-testing tool
Implemented a stress-testing tool for uprobes/uretprobes. It constantly triggers a set of user space functions, in parallel it attached and detached uprobes and uretprobes to random subset of them. To make things more interesting we also randomly and in parallel mmap() /proc/self/exe and fork() process, to trigger all the different code paths in uprobe-related functionality in the kernel. Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
- Loading branch information
Showing
5 changed files
with
856 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,3 +14,6 @@ | |
/lsm | ||
/cmake-build-debug/ | ||
/cmake-build-release/ | ||
/uprobe-stress | ||
.gdb_history | ||
|
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,30 @@ | ||
// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause | ||
#include "vmlinux.h" | ||
#include <bpf/bpf_helpers.h> | ||
#include <bpf/bpf_tracing.h> | ||
#include "uprobe-stress.h" | ||
|
||
char LICENSE[] SEC("license") = "Dual BSD/GPL"; | ||
|
||
struct counter enter_hits[MAX_CPUS]; | ||
struct counter exit_hits[MAX_CPUS]; | ||
|
||
SEC("uprobe.multi") | ||
int uprobe(struct pt_regs *ctx) | ||
{ | ||
int cpu = bpf_get_smp_processor_id(); | ||
|
||
__sync_add_and_fetch(&enter_hits[cpu & CPU_MASK].value, 1); | ||
|
||
return 0; | ||
} | ||
|
||
SEC("uretprobe.multi") | ||
int uretprobe(struct pt_regs *ctx) | ||
{ | ||
int cpu = bpf_get_smp_processor_id(); | ||
|
||
__sync_add_and_fetch(&exit_hits[cpu & CPU_MASK].value, 1); | ||
|
||
return 0; | ||
} |
Oops, something went wrong.