From cc792236bc7fe85f987c998994958029cdd9c3c0 Mon Sep 17 00:00:00 2001 From: Officeyutong Date: Sat, 6 Jan 2024 00:15:11 +0800 Subject: [PATCH] example/tailcall: add README (#133) --- example/tailcall_minimal/README.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 example/tailcall_minimal/README.md diff --git a/example/tailcall_minimal/README.md b/example/tailcall_minimal/README.md new file mode 100644 index 00000000..d83dd456 --- /dev/null +++ b/example/tailcall_minimal/README.md @@ -0,0 +1,30 @@ +# tailcall example + +This is an example demonstrating userspace to kernel tailcall. + +## Usage + +``` +make -j$(nproc) +``` + +### Terminal 1 +``` +bpftime load ./tailcall_minimal +``` + +### Terminal 2 + +``` +bpftime start ./victim +``` + +### Behavior + +See `/sys/kernel/debug/tracing/trace_pipe ` and check whether there are lines containing `Invoked!` + +## About this example + +`tailcall_minimal.bpf.c` itself is a uprobe ebpf program. It will be triggered when `./victim:add_func` was invoked, and it will run `bpf_tail_call` to call a kernel ebpf program, whose kernel fd is stored in the prog array. + +`tailcall_minimal.c` is a loader program. It executes the original syscall, loads an ebpf program into kernel (which printf `Invoked!` to trace_pipe), and stores kernel fd into the userspace prog array