Skip to content

Commit

Permalink
example/tailcall: add README (#133)
Browse files Browse the repository at this point in the history
  • Loading branch information
Officeyutong authored Jan 5, 2024
1 parent 9222c27 commit cc79223
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions example/tailcall_minimal/README.md
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit cc79223

Please sign in to comment.