aboutsummaryrefslogtreecommitdiffstats
path: root/sys/linux/bpf.txt
diff options
context:
space:
mode:
authorPaul Chaignon <paul.chaignon@gmail.com>2023-11-07 21:11:31 +0100
committerAleksandr Nogikh <nogikh@google.com>2023-11-09 18:26:45 +0000
commiteb146eaf8a525cbaaf511a013d0dbb70bb1207b9 (patch)
tree55015bdf9bdfa59baca350b80a29176d68151784 /sys/linux/bpf.txt
parentec3b566eb26bbe8fa4cf8a9f8625712a21286bf7 (diff)
sys/linux: describe BPF helper bpf_ringbuf_output
This helper has the prototype: bpf_ringbuf_output(void *ringbuf, void *data, u64 size, u64 flags) We need to prepare the second argument (R2) on the stack. We use an 8 bytes data value initialized to some random value on the stack and pointed to by R2. The third argument therefore needs to be 8 (for 8 bytes). Signed-off-by: Paul Chaignon <paul.chaignon@gmail.com>
Diffstat (limited to 'sys/linux/bpf.txt')
-rw-r--r--sys/linux/bpf.txt20
1 files changed, 20 insertions, 0 deletions
diff --git a/sys/linux/bpf.txt b/sys/linux/bpf.txt
index 72e94157e..c66ab24b5 100644
--- a/sys/linux/bpf.txt
+++ b/sys/linux/bpf.txt
@@ -425,6 +425,7 @@ bpf_insn [
snprintf bpf_insn_snprintf
tail_call bpf_insn_tail_call
ringbuf_query bpf_insn_ringbuf_query
+ ringbuf_output bpf_insn_ringbuf_output
] [varlen]
bpf_insn_generic {
@@ -795,6 +796,25 @@ bpf_insn_ringbuf_query {
insn3 bpf_insn_call_helper_t[const[BPF_FUNC_ringbuf_query, int32]]
}
+# (18) r1 = map[id:16]
+# (b7) r8 = X
+# (7b) *(u64 *)(r10 -8) = r8
+# (bf) r2 = r10
+# (07) r2 += -8
+# (b7) r3 = 8
+# (b7) r4 = 0
+# (85) call bpf_ringbuf_output#322192
+bpf_insn_ringbuf_output {
+ insn1 bpf_insn_tail_call_map_fd[BPF_REG_1]
+ insn2 bpf_insn_mov_imm_any[BPF_REG_8]
+ insn3 bpf_insn_st64_reg[BPF_REG_8, BPF_REG_10, -8]
+ insn4 bpf_insn_mov_reg[BPF_REG_10, BPF_REG_2]
+ insn5 bpf_insn_op_imm[BPF_REG_2, BPF_ADD0, -8]
+ insn6 bpf_insn_mov_imm[BPF_REG_3, 8]
+ insn7 bpf_insn_mov_imm[BPF_REG_4, 0]
+ insn8 bpf_insn_call_helper_t[const[BPF_FUNC_ringbuf_output, int32]]
+}
+
define MAX_BPF_REG __MAX_BPF_REG
bpf_obj_pin_map [