aboutsummaryrefslogtreecommitdiffstats
path: root/sys/linux/test
diff options
context:
space:
mode:
authorPaul Chaignon <paul.chaignon@gmail.com>2024-09-09 14:04:02 +0200
committerAleksandr Nogikh <nogikh@google.com>2024-09-11 15:44:33 +0000
commitfd6ac064b455d73026e1a082d723711015a6aa6b (patch)
tree6d20bf9eaf0df60de438b1a3eb61842a674b3d91 /sys/linux/test
parent7308f9d5a4da8ea4e2a9a0748ceb0921333c11f4 (diff)
sys/linux: replace id_or_fd with more precise version
The id_or_fd union was introduced before we had conditional fields to represent IDs or fds for BPF programs or links. The union was overapproximating those specific types. With conditional fields, we can now use information from other fields to determine precisely which type from the union is expected. For example, with BPF_PROG_ATTACH, if BPF_F_ID is the only flag, then the relative_fd field should be interpreted as a program ID. Signed-off-by: Paul Chaignon <paul.chaignon@gmail.com>
Diffstat (limited to 'sys/linux/test')
-rw-r--r--sys/linux/test/bpf_cgroup4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/linux/test/bpf_cgroup b/sys/linux/test/bpf_cgroup
index 0c31e3442..1ec4c55a9 100644
--- a/sys/linux/test/bpf_cgroup
+++ b/sys/linux/test/bpf_cgroup
@@ -10,7 +10,7 @@ r2 = bpf$PROG_LOAD(AUTO, &AUTO={0x17, AUTO, &AUTO=@framed={{AUTO, AUTO, AUTO, AU
r3 = openat(0xffffffffffffff9c, &AUTO='./cgroup\x00', 0x0, 0x0)
-r4 = bpf$BPF_PROG_ATTACH(AUTO, &AUTO={@cgroup=r3, r2, 0x12, 0x0, 0x0, @prog_id=0x0, 0x0}, AUTO)
+r4 = bpf$BPF_PROG_ATTACH(AUTO, &AUTO={@cgroup=r3, r2, 0x12, 0x0, 0x0, @void, @value=0x0, @void, @void, 0x0}, AUTO)
# It should fail now.
@@ -18,7 +18,7 @@ r5 = write$tcp_congestion(r0, &AUTO='reno\x00', AUTO) # EPERM
# Detach the BPF program.
-r6 = bpf$BPF_PROG_DETACH(AUTO, &AUTO={@cgroup=r3, r2, 0x12, 0x0, 0x0, @prog_id=0x0, 0x0}, AUTO)
+r6 = bpf$BPF_PROG_DETACH(AUTO, &AUTO={@cgroup=r3, r2, 0x12, 0x0, 0x0, @void, @value=0x0, @void, @void, 0x0}, AUTO)
# It should work again.