Jakub Kicinski | ff69c21 | 2017-10-04 20:10:05 -0700 | [diff] [blame] | 1 | ================ |
| 2 | bpftool-prog |
| 3 | ================ |
| 4 | ------------------------------------------------------------------------------- |
| 5 | tool for inspection and simple manipulation of eBPF progs |
| 6 | ------------------------------------------------------------------------------- |
| 7 | |
| 8 | :Manual section: 8 |
| 9 | |
| 10 | SYNOPSIS |
| 11 | ======== |
| 12 | |
| 13 | | **bpftool** prog show [*PROG*] |
Quentin Monnet | 8dfbc6d | 2017-10-19 15:46:25 -0700 | [diff] [blame] | 14 | | **bpftool** prog dump xlated *PROG* [{file *FILE* | opcodes }] |
| 15 | | **bpftool** prog dump jited *PROG* [{file *FILE* | opcodes }] |
Jakub Kicinski | ff69c21 | 2017-10-04 20:10:05 -0700 | [diff] [blame] | 16 | | **bpftool** prog pin *PROG* *FILE* |
| 17 | | **bpftool** prog help |
| 18 | | |
| 19 | | *PROG* := { id *PROG_ID* | pinned *FILE* | tag *PROG_TAG* } |
| 20 | |
| 21 | DESCRIPTION |
| 22 | =========== |
| 23 | **bpftool prog show** [*PROG*] |
| 24 | Show information about loaded programs. If *PROG* is |
| 25 | specified show information only about given program, otherwise |
| 26 | list all programs currently loaded on the system. |
| 27 | |
| 28 | Output will start with program ID followed by program type and |
| 29 | zero or more named attributes (depending on kernel version). |
| 30 | |
Quentin Monnet | 8dfbc6d | 2017-10-19 15:46:25 -0700 | [diff] [blame] | 31 | **bpftool prog dump xlated** *PROG* [{ **file** *FILE* | **opcodes** }] |
Jakub Kicinski | c9c3599 | 2017-10-09 10:30:13 -0700 | [diff] [blame] | 32 | Dump eBPF instructions of the program from the kernel. |
| 33 | If *FILE* is specified image will be written to a file, |
| 34 | otherwise it will be disassembled and printed to stdout. |
| 35 | |
| 36 | **opcodes** controls if raw opcodes will be printed. |
Jakub Kicinski | ff69c21 | 2017-10-04 20:10:05 -0700 | [diff] [blame] | 37 | |
Quentin Monnet | 8dfbc6d | 2017-10-19 15:46:25 -0700 | [diff] [blame] | 38 | **bpftool prog dump jited** *PROG* [{ **file** *FILE* | **opcodes** }] |
Jakub Kicinski | ff69c21 | 2017-10-04 20:10:05 -0700 | [diff] [blame] | 39 | Dump jited image (host machine code) of the program. |
| 40 | If *FILE* is specified image will be written to a file, |
| 41 | otherwise it will be disassembled and printed to stdout. |
| 42 | |
| 43 | **opcodes** controls if raw opcodes will be printed. |
| 44 | |
| 45 | **bpftool prog pin** *PROG* *FILE* |
| 46 | Pin program *PROG* as *FILE*. |
| 47 | |
| 48 | Note: *FILE* must be located in *bpffs* mount. |
| 49 | |
| 50 | **bpftool prog help** |
| 51 | Print short help message. |
| 52 | |
Quentin Monnet | a2bc2e5 | 2017-10-23 09:24:06 -0700 | [diff] [blame^] | 53 | OPTIONS |
| 54 | ======= |
| 55 | -h, --help |
| 56 | Print short generic help message (similar to **bpftool help**). |
| 57 | |
| 58 | -v, --version |
| 59 | Print version number (similar to **bpftool version**). |
| 60 | |
Jakub Kicinski | ff69c21 | 2017-10-04 20:10:05 -0700 | [diff] [blame] | 61 | EXAMPLES |
| 62 | ======== |
| 63 | **# bpftool prog show** |
| 64 | :: |
| 65 | |
Jakub Kicinski | 2dc7c1f | 2017-10-16 10:12:54 -0700 | [diff] [blame] | 66 | 10: xdp name some_prog tag 005a3d2123620c8b |
Jakub Kicinski | ff69c21 | 2017-10-04 20:10:05 -0700 | [diff] [blame] | 67 | loaded_at Sep 29/20:11 uid 0 |
| 68 | xlated 528B jited 370B memlock 4096B map_ids 10 |
| 69 | |
| 70 | | |
| 71 | | **# bpftool prog dump xlated id 10 file /tmp/t** |
| 72 | | **# ls -l /tmp/t** |
| 73 | | -rw------- 1 root root 560 Jul 22 01:42 /tmp/t |
| 74 | |
| 75 | | |
| 76 | | **# bpftool prog dum jited pinned /sys/fs/bpf/prog** |
| 77 | |
| 78 | :: |
| 79 | |
| 80 | push %rbp |
| 81 | mov %rsp,%rbp |
| 82 | sub $0x228,%rsp |
| 83 | sub $0x28,%rbp |
| 84 | mov %rbx,0x0(%rbp) |
| 85 | |
| 86 | |
| 87 | |
| 88 | SEE ALSO |
| 89 | ======== |
| 90 | **bpftool**\ (8), **bpftool-map**\ (8) |