From fd6ac064b455d73026e1a082d723711015a6aa6b Mon Sep 17 00:00:00 2001 From: Paul Chaignon Date: Mon, 9 Sep 2024 14:04:02 +0200 Subject: 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 --- sys/linux/test/bpf_cgroup | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sys/linux/test') 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. -- cgit mrf-deployment