Repository navigation
bpf: support module BTF in BTF display helpers - #480
kernel-patches-bot wants to merge 4 commits into
Conversation
|
Master branch: fdd8b82 |
|
Master branch: 846c3c9 |
ed1e1aa to
dec1a78
Compare
|
Master branch: 2fa3515 |
dec1a78 to
a69138d
Compare
|
Master branch: 5c667dc |
a69138d to
7357e16
Compare
|
Master branch: 34da872 |
7357e16 to
856c4ed
Compare
|
Master branch: e1868b9 |
856c4ed to
7858e42
Compare
btf_module_mutex is used when manipulating the BTF module list. However we will wish to look up this list from BPF program context, and such contexts can include interrupt state where we cannot sleep due to a mutex_lock(). RCU usage here conforms quite closely to the example in the system call auditing example in Documentation/RCU/listRCU.rst ; and as such we can eliminate the lock and use list_del_rcu()/call_rcu() on module removal, and list_add_rcu() for module addition. Signed-off-by: Alan Maguire <[email protected]>
bpf_snprintf_btf and bpf_seq_printf_btf use a "struct btf_ptr *" argument that specifies type information about the type to be displayed. Augment this information to include an object id. If this id is 0, the assumption is that it refers to a core kernel type from vmlinux; otherwise the object id specifies the module the type is in, or if no such id is found in the module list, we fall back to vmlinux. Signed-off-by: Alan Maguire <[email protected]>
…intf_btf Verify that specifying a module object id in "struct btf_ptr *" along with a type id of a module-specific type will succeed. veth_stats_rx() is chosen because its function signature consists of a module-specific type "struct veth_stats" and a kernel-specific one "struct net_device". Currently the tests take the messy approach of determining object and type ids for the relevant module/function; __builtin_btf_type_id() supports object ids by returning a 64-bit value, but need to find a good way to determine if that support is present. Signed-off-by: Alan Maguire <[email protected]>
|
Master branch: 2f4b031 |
7858e42 to
f4136f4
Compare
|
At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=396559 expired. Closing PR. |
We try using cancel_delayed_work_sync() to prevent the work from enabling NAPI. This is insufficient since we don't disable the source of the refill work scheduling. This means an NAPI poll callback after cancel_delayed_work_sync() can schedule the refill work then can re-enable the NAPI that leads to use-after-free [1]. Since the work can enable NAPI, we can't simply disable NAPI before calling cancel_delayed_work_sync(). So fix this by introducing a dedicated boolean to control whether or not the work could be scheduled from NAPI. [1] ================================================================== BUG: KASAN: use-after-free in refill_work+0x43/0xd4 Read of size 2 at addr ffff88810562c92e by task kworker/2:1/42 CPU: 2 PID: 42 Comm: kworker/2:1 Not tainted 5.19.0-rc1+ #480 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014 Workqueue: events refill_work Call Trace: <TASK> dump_stack_lvl+0x34/0x44 print_report.cold+0xbb/0x6ac ? _printk+0xad/0xde ? refill_work+0x43/0xd4 kasan_report+0xa8/0x130 ? refill_work+0x43/0xd4 refill_work+0x43/0xd4 process_one_work+0x43d/0x780 worker_thread+0x2a0/0x6f0 ? process_one_work+0x780/0x780 kthread+0x167/0x1a0 ? kthread_exit+0x50/0x50 ret_from_fork+0x22/0x30 </TASK> ... Fixes: b2baed6 ("virtio_net: set/cancel work on ndo_open/ndo_stop") Signed-off-by: Jason Wang <[email protected]> Acked-by: Michael S. Tsirkin <[email protected]> Reviewed-by: Xuan Zhuo <[email protected]> Signed-off-by: David S. Miller <[email protected]>
Fix checkpatch code style warnings: WARNING: quoted string split across lines kernel-patches#480: FILE: net/core/pktgen.c:480: + "Packet Generator for packet performance testing. " + "Version: " VERSION "\n"; WARNING: quoted string split across lines kernel-patches#632: FILE: net/core/pktgen.c:632: + " udp_src_min: %d udp_src_max: %d" + " udp_dst_min: %d udp_dst_max: %d\n", Signed-off-by: Peter Seiderer <[email protected]> Signed-off-by: NipaLocal <nipa@local>
Fix checkpatch code style warnings: WARNING: quoted string split across lines kernel-patches#480: FILE: net/core/pktgen.c:480: + "Packet Generator for packet performance testing. " + "Version: " VERSION "\n"; WARNING: quoted string split across lines kernel-patches#632: FILE: net/core/pktgen.c:632: + " udp_src_min: %d udp_src_max: %d" + " udp_dst_min: %d udp_dst_max: %d\n", Signed-off-by: Peter Seiderer <[email protected]> Signed-off-by: NipaLocal <nipa@local>
Fix checkpatch code style warnings: WARNING: quoted string split across lines kernel-patches#480: FILE: net/core/pktgen.c:480: + "Packet Generator for packet performance testing. " + "Version: " VERSION "\n"; WARNING: quoted string split across lines kernel-patches#632: FILE: net/core/pktgen.c:632: + " udp_src_min: %d udp_src_max: %d" + " udp_dst_min: %d udp_dst_max: %d\n", Signed-off-by: Peter Seiderer <[email protected]> Signed-off-by: NipaLocal <nipa@local>
Fix checkpatch code style warnings: WARNING: quoted string split across lines kernel-patches#480: FILE: net/core/pktgen.c:480: + "Packet Generator for packet performance testing. " + "Version: " VERSION "\n"; WARNING: quoted string split across lines kernel-patches#632: FILE: net/core/pktgen.c:632: + " udp_src_min: %d udp_src_max: %d" + " udp_dst_min: %d udp_dst_max: %d\n", Signed-off-by: Peter Seiderer <[email protected]> Signed-off-by: NipaLocal <nipa@local>
Fix checkpatch code style warnings: WARNING: quoted string split across lines kernel-patches#480: FILE: net/core/pktgen.c:480: + "Packet Generator for packet performance testing. " + "Version: " VERSION "\n"; WARNING: quoted string split across lines kernel-patches#632: FILE: net/core/pktgen.c:632: + " udp_src_min: %d udp_src_max: %d" + " udp_dst_min: %d udp_dst_max: %d\n", Signed-off-by: Peter Seiderer <[email protected]> Signed-off-by: NipaLocal <nipa@local>
Fix checkpatch code style warnings: WARNING: quoted string split across lines kernel-patches#480: FILE: net/core/pktgen.c:480: + "Packet Generator for packet performance testing. " + "Version: " VERSION "\n"; WARNING: quoted string split across lines kernel-patches#632: FILE: net/core/pktgen.c:632: + " udp_src_min: %d udp_src_max: %d" + " udp_dst_min: %d udp_dst_max: %d\n", Signed-off-by: Peter Seiderer <[email protected]> Signed-off-by: NipaLocal <nipa@local>
Fix checkpatch code style warnings: WARNING: quoted string split across lines kernel-patches#480: FILE: net/core/pktgen.c:480: + "Packet Generator for packet performance testing. " + "Version: " VERSION "\n"; WARNING: quoted string split across lines kernel-patches#632: FILE: net/core/pktgen.c:632: + " udp_src_min: %d udp_src_max: %d" + " udp_dst_min: %d udp_dst_max: %d\n", Signed-off-by: Peter Seiderer <[email protected]> Signed-off-by: NipaLocal <nipa@local>
Fix checkpatch code style warnings: WARNING: quoted string split across lines kernel-patches#480: FILE: net/core/pktgen.c:480: + "Packet Generator for packet performance testing. " + "Version: " VERSION "\n"; WARNING: quoted string split across lines kernel-patches#632: FILE: net/core/pktgen.c:632: + " udp_src_min: %d udp_src_max: %d" + " udp_dst_min: %d udp_dst_max: %d\n", Signed-off-by: Peter Seiderer <[email protected]> Signed-off-by: NipaLocal <nipa@local>
Fix checkpatch code style warnings: WARNING: quoted string split across lines kernel-patches#480: FILE: net/core/pktgen.c:480: + "Packet Generator for packet performance testing. " + "Version: " VERSION "\n"; WARNING: quoted string split across lines kernel-patches#632: FILE: net/core/pktgen.c:632: + " udp_src_min: %d udp_src_max: %d" + " udp_dst_min: %d udp_dst_max: %d\n", Signed-off-by: Peter Seiderer <[email protected]> Signed-off-by: NipaLocal <nipa@local>
Fix checkpatch code style warnings: WARNING: quoted string split across lines kernel-patches#480: FILE: net/core/pktgen.c:480: + "Packet Generator for packet performance testing. " + "Version: " VERSION "\n"; WARNING: quoted string split across lines kernel-patches#632: FILE: net/core/pktgen.c:632: + " udp_src_min: %d udp_src_max: %d" + " udp_dst_min: %d udp_dst_max: %d\n", Signed-off-by: Peter Seiderer <[email protected]> Signed-off-by: NipaLocal <nipa@local>
Fix checkpatch code style warnings: WARNING: quoted string split across lines kernel-patches#480: FILE: net/core/pktgen.c:480: + "Packet Generator for packet performance testing. " + "Version: " VERSION "\n"; WARNING: quoted string split across lines kernel-patches#632: FILE: net/core/pktgen.c:632: + " udp_src_min: %d udp_src_max: %d" + " udp_dst_min: %d udp_dst_max: %d\n", Signed-off-by: Peter Seiderer <[email protected]> Signed-off-by: NipaLocal <nipa@local>
Fix checkpatch code style warnings: WARNING: quoted string split across lines kernel-patches#480: FILE: net/core/pktgen.c:480: + "Packet Generator for packet performance testing. " + "Version: " VERSION "\n"; WARNING: quoted string split across lines kernel-patches#632: FILE: net/core/pktgen.c:632: + " udp_src_min: %d udp_src_max: %d" + " udp_dst_min: %d udp_dst_max: %d\n", Signed-off-by: Peter Seiderer <[email protected]> Signed-off-by: NipaLocal <nipa@local>
Fix checkpatch code style warnings: WARNING: quoted string split across lines kernel-patches#480: FILE: net/core/pktgen.c:480: + "Packet Generator for packet performance testing. " + "Version: " VERSION "\n"; WARNING: quoted string split across lines kernel-patches#632: FILE: net/core/pktgen.c:632: + " udp_src_min: %d udp_src_max: %d" + " udp_dst_min: %d udp_dst_max: %d\n", Signed-off-by: Peter Seiderer <[email protected]> Signed-off-by: NipaLocal <nipa@local>
Fix checkpatch code style warnings: WARNING: quoted string split across lines kernel-patches#480: FILE: net/core/pktgen.c:480: + "Packet Generator for packet performance testing. " + "Version: " VERSION "\n"; WARNING: quoted string split across lines kernel-patches#632: FILE: net/core/pktgen.c:632: + " udp_src_min: %d udp_src_max: %d" + " udp_dst_min: %d udp_dst_max: %d\n", Signed-off-by: Peter Seiderer <[email protected]> Signed-off-by: NipaLocal <nipa@local>
Fix checkpatch code style warnings: WARNING: quoted string split across lines kernel-patches#480: FILE: net/core/pktgen.c:480: + "Packet Generator for packet performance testing. " + "Version: " VERSION "\n"; WARNING: quoted string split across lines kernel-patches#632: FILE: net/core/pktgen.c:632: + " udp_src_min: %d udp_src_max: %d" + " udp_dst_min: %d udp_dst_max: %d\n", Signed-off-by: Peter Seiderer <[email protected]> Signed-off-by: NipaLocal <nipa@local>
Fix checkpatch code style warnings: WARNING: quoted string split across lines kernel-patches#480: FILE: net/core/pktgen.c:480: + "Packet Generator for packet performance testing. " + "Version: " VERSION "\n"; WARNING: quoted string split across lines kernel-patches#632: FILE: net/core/pktgen.c:632: + " udp_src_min: %d udp_src_max: %d" + " udp_dst_min: %d udp_dst_max: %d\n", Signed-off-by: Peter Seiderer <[email protected]> Signed-off-by: NipaLocal <nipa@local>
Fix checkpatch code style warnings: WARNING: quoted string split across lines kernel-patches#480: FILE: net/core/pktgen.c:480: + "Packet Generator for packet performance testing. " + "Version: " VERSION "\n"; WARNING: quoted string split across lines kernel-patches#632: FILE: net/core/pktgen.c:632: + " udp_src_min: %d udp_src_max: %d" + " udp_dst_min: %d udp_dst_max: %d\n", Signed-off-by: Peter Seiderer <[email protected]> Signed-off-by: NipaLocal <nipa@local>
Fix checkpatch code style warnings: WARNING: quoted string split across lines kernel-patches#480: FILE: net/core/pktgen.c:480: + "Packet Generator for packet performance testing. " + "Version: " VERSION "\n"; WARNING: quoted string split across lines kernel-patches#632: FILE: net/core/pktgen.c:632: + " udp_src_min: %d udp_src_max: %d" + " udp_dst_min: %d udp_dst_max: %d\n", Signed-off-by: Peter Seiderer <[email protected]> Signed-off-by: NipaLocal <nipa@local>
Fix checkpatch code style warnings: WARNING: quoted string split across lines kernel-patches#480: FILE: net/core/pktgen.c:480: + "Packet Generator for packet performance testing. " + "Version: " VERSION "\n"; WARNING: quoted string split across lines kernel-patches#632: FILE: net/core/pktgen.c:632: + " udp_src_min: %d udp_src_max: %d" + " udp_dst_min: %d udp_dst_max: %d\n", Signed-off-by: Peter Seiderer <[email protected]> Signed-off-by: NipaLocal <nipa@local>
Fix checkpatch code style warnings: WARNING: quoted string split across lines kernel-patches#480: FILE: net/core/pktgen.c:480: + "Packet Generator for packet performance testing. " + "Version: " VERSION "\n"; WARNING: quoted string split across lines kernel-patches#632: FILE: net/core/pktgen.c:632: + " udp_src_min: %d udp_src_max: %d" + " udp_dst_min: %d udp_dst_max: %d\n", Signed-off-by: Peter Seiderer <[email protected]> Signed-off-by: NipaLocal <nipa@local>
Fix checkpatch code style warnings: WARNING: quoted string split across lines kernel-patches#480: FILE: net/core/pktgen.c:480: + "Packet Generator for packet performance testing. " + "Version: " VERSION "\n"; WARNING: quoted string split across lines kernel-patches#632: FILE: net/core/pktgen.c:632: + " udp_src_min: %d udp_src_max: %d" + " udp_dst_min: %d udp_dst_max: %d\n", Signed-off-by: Peter Seiderer <[email protected]> Signed-off-by: NipaLocal <nipa@local>
Fix checkpatch code style warnings: WARNING: quoted string split across lines kernel-patches#480: FILE: net/core/pktgen.c:480: + "Packet Generator for packet performance testing. " + "Version: " VERSION "\n"; WARNING: quoted string split across lines kernel-patches#632: FILE: net/core/pktgen.c:632: + " udp_src_min: %d udp_src_max: %d" + " udp_dst_min: %d udp_dst_max: %d\n", Signed-off-by: Peter Seiderer <[email protected]> Reviewed-by: Toke Høiland-Jørgensen <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
Four stream tests fail with BPF_GCC: test_stream_arena_fault_address:FAIL:stream__open_and_load unexpected error: -13 #479 stream_oversize:FAIL #480 stream_partial_read:FAIL #482 stream_syscall:FAIL They call stream__open_and_load(), which loads every program in the object, and two of those do not verify: #481/11 stream_success/stream_arena_subprog_fault:FAIL #481/12 stream_success/stream_arena_callback_fault:FAIL Both dereference an arena pointer and leave the cast to the compiler: int __arena *addr = (int __arena *)0xdeadbeef; *addr = 1; Without arena support __arena is only btf_type_tag("arena"), so no addr_space_cast is emitted and the store is to a scalar, which the verifier rejects. GCC splits it into byte stores, 0xdeadbeef not being aligned: r2=3735928559 ll *(u8*)(r2+0)=1 <- plain store, no cast Their siblings in the same file do not rely on the compiler; they use bpf_addr_space_cast(), which emits the instruction byte by byte and works anywhere. Do the same here. The address space has to come off the local as well. Left on, a compiler that supports arenas casts a second time for the dereference, on a pointer the explicit cast has already converted: r2 = addr_space_cast(r2, 0, 1) r3 = addr_space_cast(r2, 0, 1) *(u32*)(r3+0)=1 With it off, GCC with and without arena support and clang all emit the same thing, which is what the test wants: r2 = addr_space_cast(r2, 0, 1) *(u32*)(r2+0)=1 What these two assert is the fault report, not how the pointer was produced, so nothing they were testing is lost. Measured on bpf-next with a stock bpf-gcc, test_progs before and after. Fifteen results go FAIL -> OK -- every test that loads this object, not just the arena ones: stream_arena_fault_address stream_oversize stream_fd stream_fd/blocking stream_partial_read stream_fd/edge stream_fd/empty stream_success stream_fd/hup stream_fd/nmi_epoll stream_success/stream_arena_callback_fault stream_fd/open stream_fd/nonblock stream_success/stream_arena_subprog_fault stream_syscall and the five stream_arena_fault_address subtests become visible for the first time (read, write, xchg, cmpxchg and load_acquire faults). Signed-off-by: Vineet Gupta <[email protected]>
Four stream tests fail with BPF_GCC: test_stream_arena_fault_address:FAIL:stream__open_and_load unexpected error: -13 #479 stream_oversize:FAIL #480 stream_partial_read:FAIL #482 stream_syscall:FAIL They call stream__open_and_load(), which loads every program in the object, and two of those do not verify: #481/11 stream_success/stream_arena_subprog_fault:FAIL #481/12 stream_success/stream_arena_callback_fault:FAIL Both dereference an arena pointer and leave the cast to the compiler: int __arena *addr = (int __arena *)0xdeadbeef; *addr = 1; Without arena support __arena is only btf_type_tag("arena"), so no addr_space_cast is emitted and the store is to a scalar, which the verifier rejects. GCC splits it into byte stores, 0xdeadbeef not being aligned: r2=3735928559 ll *(u8*)(r2+0)=1 <- plain store, no cast Their siblings in the same file do not rely on the compiler; they use bpf_addr_space_cast(), which emits the instruction byte by byte and works anywhere. Do the same here. The address space has to come off the local as well. Left on, a compiler that supports arenas casts a second time for the dereference, on a pointer the explicit cast has already converted: r2 = addr_space_cast(r2, 0, 1) r3 = addr_space_cast(r2, 0, 1) *(u32*)(r3+0)=1 With it off, GCC with and without arena support and clang all emit the same thing, which is what the test wants: r2 = addr_space_cast(r2, 0, 1) *(u32*)(r2+0)=1 What these two assert is the fault report, not how the pointer was produced, so nothing they were testing is lost. Measured on bpf-next with a stock bpf-gcc, test_progs before and after. Fifteen results go FAIL -> OK -- every test that loads this object, not just the arena ones: stream_arena_fault_address stream_oversize stream_fd stream_fd/blocking stream_partial_read stream_fd/edge stream_fd/empty stream_success stream_fd/hup stream_fd/nmi_epoll stream_success/stream_arena_callback_fault stream_fd/open stream_fd/nonblock stream_success/stream_arena_subprog_fault stream_syscall and the five stream_arena_fault_address subtests become visible for the first time (read, write, xchg, cmpxchg and load_acquire faults). Signed-off-by: Vineet Gupta <[email protected]>
Four stream tests fail with BPF_GCC: test_stream_arena_fault_address:FAIL:stream__open_and_load unexpected error: -13 #479 stream_oversize:FAIL #480 stream_partial_read:FAIL #482 stream_syscall:FAIL They call stream__open_and_load(), which loads every program in the object, and two of those do not verify: #481/11 stream_success/stream_arena_subprog_fault:FAIL #481/12 stream_success/stream_arena_callback_fault:FAIL Both dereference an arena pointer and leave the cast to the compiler: int __arena *addr = (int __arena *)0xdeadbeef; *addr = 1; Without arena support __arena is only btf_type_tag("arena"), so no addr_space_cast is emitted and the store is to a scalar, which the verifier rejects. GCC splits it into byte stores, 0xdeadbeef not being aligned: r2=3735928559 ll *(u8*)(r2+0)=1 <- plain store, no cast Their siblings in the same file do not rely on the compiler; they use bpf_addr_space_cast(), which emits the instruction byte by byte and works anywhere. Do the same here. The address space has to come off the local as well. Left on, a compiler that supports arenas casts a second time for the dereference, on a pointer the explicit cast has already converted: r2 = addr_space_cast(r2, 0, 1) r3 = addr_space_cast(r2, 0, 1) *(u32*)(r3+0)=1 With it off, GCC with and without arena support and clang all emit the same thing, which is what the test wants: r2 = addr_space_cast(r2, 0, 1) *(u32*)(r2+0)=1 What these two assert is the fault report, not how the pointer was produced, so nothing they were testing is lost. Measured on bpf-next with a stock bpf-gcc, test_progs before and after. Fifteen results go FAIL -> OK -- every test that loads this object, not just the arena ones: stream_arena_fault_address stream_oversize stream_fd stream_fd/blocking stream_partial_read stream_fd/edge stream_fd/empty stream_success stream_fd/hup stream_fd/nmi_epoll stream_success/stream_arena_callback_fault stream_fd/open stream_fd/nonblock stream_success/stream_arena_subprog_fault stream_syscall and the five stream_arena_fault_address subtests become visible for the first time (read, write, xchg, cmpxchg and load_acquire faults). Signed-off-by: Vineet Gupta <[email protected]>
Four stream tests fail with BPF_GCC: test_stream_arena_fault_address:FAIL:stream__open_and_load unexpected error: -13 #479 stream_oversize:FAIL #480 stream_partial_read:FAIL #482 stream_syscall:FAIL They call stream__open_and_load(), which loads every program in the object, and two of those do not verify: #481/11 stream_success/stream_arena_subprog_fault:FAIL #481/12 stream_success/stream_arena_callback_fault:FAIL Both dereference an arena pointer and leave the cast to the compiler: int __arena *addr = (int __arena *)0xdeadbeef; *addr = 1; Without arena support __arena is only btf_type_tag("arena"), so no addr_space_cast is emitted and the store is to a scalar, which the verifier rejects. GCC splits it into byte stores, 0xdeadbeef not being aligned: r2=3735928559 ll *(u8*)(r2+0)=1 <- plain store, no cast Their siblings in the same file do not rely on the compiler; they use bpf_addr_space_cast(), which emits the instruction byte by byte and works anywhere. Do the same here. The address space has to come off the local as well. Left on, a compiler that supports arenas casts a second time for the dereference, on a pointer the explicit cast has already converted: r2 = addr_space_cast(r2, 0, 1) r3 = addr_space_cast(r2, 0, 1) *(u32*)(r3+0)=1 With it off, GCC with and without arena support and clang all emit the same thing, which is what the test wants: r2 = addr_space_cast(r2, 0, 1) *(u32*)(r2+0)=1 What these two assert is the fault report, not how the pointer was produced, so nothing they were testing is lost. Measured on bpf-next with a stock bpf-gcc, test_progs before and after. Fifteen results go FAIL -> OK -- every test that loads this object, not just the arena ones: stream_arena_fault_address stream_oversize stream_fd stream_fd/blocking stream_partial_read stream_fd/edge stream_fd/empty stream_success stream_fd/hup stream_fd/nmi_epoll stream_success/stream_arena_callback_fault stream_fd/open stream_fd/nonblock stream_success/stream_arena_subprog_fault stream_syscall and the five stream_arena_fault_address subtests become visible for the first time (read, write, xchg, cmpxchg and load_acquire faults). Signed-off-by: Vineet Gupta <[email protected]>
Four stream tests fail with BPF_GCC: test_stream_arena_fault_address:FAIL:stream__open_and_load unexpected error: -13 #479 stream_oversize:FAIL #480 stream_partial_read:FAIL #482 stream_syscall:FAIL They call stream__open_and_load(), which loads every program in the object, and two of those do not verify: #481/11 stream_success/stream_arena_subprog_fault:FAIL #481/12 stream_success/stream_arena_callback_fault:FAIL Both dereference an arena pointer and leave the cast to the compiler: int __arena *addr = (int __arena *)0xdeadbeef; *addr = 1; Without arena support __arena is only btf_type_tag("arena"), so no addr_space_cast is emitted and the store is to a scalar, which the verifier rejects. GCC splits it into byte stores, 0xdeadbeef not being aligned: r2=3735928559 ll *(u8*)(r2+0)=1 <- plain store, no cast Their siblings in the same file do not rely on the compiler; they use bpf_addr_space_cast(), which emits the instruction byte by byte and works anywhere. Do the same here. The address space has to come off the local as well. Left on, a compiler that supports arenas casts a second time for the dereference, on a pointer the explicit cast has already converted: r2 = addr_space_cast(r2, 0, 1) r3 = addr_space_cast(r2, 0, 1) *(u32*)(r3+0)=1 With it off, GCC with and without arena support and clang all emit the same thing, which is what the test wants: r2 = addr_space_cast(r2, 0, 1) *(u32*)(r2+0)=1 What these two assert is the fault report, not how the pointer was produced, so nothing they were testing is lost. Measured on bpf-next with a stock bpf-gcc, test_progs before and after. Fifteen results go FAIL -> OK -- every test that loads this object, not just the arena ones: stream_arena_fault_address stream_oversize stream_fd stream_fd/blocking stream_partial_read stream_fd/edge stream_fd/empty stream_success stream_fd/hup stream_fd/nmi_epoll stream_success/stream_arena_callback_fault stream_fd/open stream_fd/nonblock stream_success/stream_arena_subprog_fault stream_syscall and the five stream_arena_fault_address subtests become visible for the first time (read, write, xchg, cmpxchg and load_acquire faults). Signed-off-by: Vineet Gupta <[email protected]>
Four stream tests fail with BPF_GCC: test_stream_arena_fault_address:FAIL:stream__open_and_load unexpected error: -13 #479 stream_oversize:FAIL #480 stream_partial_read:FAIL #482 stream_syscall:FAIL They call stream__open_and_load(), which loads every program in the object, and two of those do not verify: #481/11 stream_success/stream_arena_subprog_fault:FAIL #481/12 stream_success/stream_arena_callback_fault:FAIL Both dereference an arena pointer and leave the cast to the compiler: int __arena *addr = (int __arena *)0xdeadbeef; *addr = 1; Without arena support __arena is only btf_type_tag("arena"), so no addr_space_cast is emitted and the store is to a scalar, which the verifier rejects. GCC splits it into byte stores, 0xdeadbeef not being aligned: r2=3735928559 ll *(u8*)(r2+0)=1 <- plain store, no cast Their siblings in the same file do not rely on the compiler; they use bpf_addr_space_cast(), which emits the instruction byte by byte and works anywhere. Do the same here. The address space has to come off the local as well. Left on, a compiler that supports arenas casts a second time for the dereference, on a pointer the explicit cast has already converted: r2 = addr_space_cast(r2, 0, 1) r3 = addr_space_cast(r2, 0, 1) *(u32*)(r3+0)=1 With it off, GCC with and without arena support and clang all emit the same thing, which is what the test wants: r2 = addr_space_cast(r2, 0, 1) *(u32*)(r2+0)=1 What these two assert is the fault report, not how the pointer was produced, so nothing they were testing is lost. Measured on bpf-next with a stock bpf-gcc, test_progs before and after. Fifteen results go FAIL -> OK -- every test that loads this object, not just the arena ones: stream_arena_fault_address stream_oversize stream_fd stream_fd/blocking stream_partial_read stream_fd/edge stream_fd/empty stream_success stream_fd/hup stream_fd/nmi_epoll stream_success/stream_arena_callback_fault stream_fd/open stream_fd/nonblock stream_success/stream_arena_subprog_fault stream_syscall and the five stream_arena_fault_address subtests become visible for the first time (read, write, xchg, cmpxchg and load_acquire faults). Signed-off-by: Vineet Gupta <[email protected]>
Four stream tests fail with BPF_GCC: test_stream_arena_fault_address:FAIL:stream__open_and_load unexpected error: -13 #479 stream_oversize:FAIL #480 stream_partial_read:FAIL #482 stream_syscall:FAIL They call stream__open_and_load(), which loads every program in the object, and two of those do not verify: #481/11 stream_success/stream_arena_subprog_fault:FAIL #481/12 stream_success/stream_arena_callback_fault:FAIL Both dereference an arena pointer and leave the cast to the compiler: int __arena *addr = (int __arena *)0xdeadbeef; *addr = 1; Without arena support __arena is only btf_type_tag("arena"), so no addr_space_cast is emitted and the store is to a scalar, which the verifier rejects. GCC splits it into byte stores, 0xdeadbeef not being aligned: r2=3735928559 ll *(u8*)(r2+0)=1 <- plain store, no cast Their siblings in the same file do not rely on the compiler; they use bpf_addr_space_cast(), which emits the instruction byte by byte and works anywhere. Do the same here. The address space has to come off the local as well. Left on, a compiler that supports arenas casts a second time for the dereference, on a pointer the explicit cast has already converted: r2 = addr_space_cast(r2, 0, 1) r3 = addr_space_cast(r2, 0, 1) *(u32*)(r3+0)=1 With it off, GCC with and without arena support and clang all emit the same thing, which is what the test wants: r2 = addr_space_cast(r2, 0, 1) *(u32*)(r2+0)=1 What these two assert is the fault report, not how the pointer was produced, so nothing they were testing is lost. Measured on bpf-next with a stock bpf-gcc, test_progs before and after. Fifteen results go FAIL -> OK -- every test that loads this object, not just the arena ones: stream_arena_fault_address stream_oversize stream_fd stream_fd/blocking stream_partial_read stream_fd/edge stream_fd/empty stream_success stream_fd/hup stream_fd/nmi_epoll stream_success/stream_arena_callback_fault stream_fd/open stream_fd/nonblock stream_success/stream_arena_subprog_fault stream_syscall and the five stream_arena_fault_address subtests become visible for the first time (read, write, xchg, cmpxchg and load_acquire faults). Signed-off-by: Vineet Gupta <[email protected]>
Four stream tests fail with BPF_GCC: test_stream_arena_fault_address:FAIL:stream__open_and_load unexpected error: -13 #479 stream_oversize:FAIL #480 stream_partial_read:FAIL #482 stream_syscall:FAIL They call stream__open_and_load(), which loads every program in the object, and two of those do not verify: #481/11 stream_success/stream_arena_subprog_fault:FAIL #481/12 stream_success/stream_arena_callback_fault:FAIL Both dereference an arena pointer and leave the cast to the compiler: int __arena *addr = (int __arena *)0xdeadbeef; *addr = 1; Without arena support __arena is only btf_type_tag("arena"), so no addr_space_cast is emitted and the store is to a scalar, which the verifier rejects. GCC splits it into byte stores, 0xdeadbeef not being aligned: r2=3735928559 ll *(u8*)(r2+0)=1 <- plain store, no cast Their siblings in the same file do not rely on the compiler; they use bpf_addr_space_cast(), which emits the instruction byte by byte and works anywhere. Do the same here. The address space has to come off the local as well. Left on, a compiler that supports arenas casts a second time for the dereference, on a pointer the explicit cast has already converted: r2 = addr_space_cast(r2, 0, 1) r3 = addr_space_cast(r2, 0, 1) *(u32*)(r3+0)=1 With it off, GCC with and without arena support and clang all emit the same thing, which is what the test wants: r2 = addr_space_cast(r2, 0, 1) *(u32*)(r2+0)=1 What these two assert is the fault report, not how the pointer was produced, so nothing they were testing is lost. Measured on bpf-next with a stock bpf-gcc, test_progs before and after. Fifteen results go FAIL -> OK -- every test that loads this object, not just the arena ones: stream_arena_fault_address stream_oversize stream_fd stream_fd/blocking stream_partial_read stream_fd/edge stream_fd/empty stream_success stream_fd/hup stream_fd/nmi_epoll stream_success/stream_arena_callback_fault stream_fd/open stream_fd/nonblock stream_success/stream_arena_subprog_fault stream_syscall and the five stream_arena_fault_address subtests become visible for the first time (read, write, xchg, cmpxchg and load_acquire faults). Signed-off-by: Vineet Gupta <[email protected]>
Four stream tests fail with BPF_GCC: test_stream_arena_fault_address:FAIL:stream__open_and_load unexpected error: -13 #479 stream_oversize:FAIL #480 stream_partial_read:FAIL #482 stream_syscall:FAIL They call stream__open_and_load(), which loads every program in the object, and two of those do not verify: #481/11 stream_success/stream_arena_subprog_fault:FAIL #481/12 stream_success/stream_arena_callback_fault:FAIL Both dereference an arena pointer and leave the cast to the compiler: int __arena *addr = (int __arena *)0xdeadbeef; *addr = 1; Without arena support __arena is only btf_type_tag("arena"), so no addr_space_cast is emitted and the store is to a scalar, which the verifier rejects. GCC splits it into byte stores, 0xdeadbeef not being aligned: r2=3735928559 ll *(u8*)(r2+0)=1 <- plain store, no cast Their siblings in the same file do not rely on the compiler; they use bpf_addr_space_cast(), which emits the instruction byte by byte and works anywhere. Do the same here. The address space has to come off the local as well. Left on, a compiler that supports arenas casts a second time for the dereference, on a pointer the explicit cast has already converted: r2 = addr_space_cast(r2, 0, 1) r3 = addr_space_cast(r2, 0, 1) *(u32*)(r3+0)=1 With it off, GCC with and without arena support and clang all emit the same thing, which is what the test wants: r2 = addr_space_cast(r2, 0, 1) *(u32*)(r2+0)=1 What these two assert is the fault report, not how the pointer was produced, so nothing they were testing is lost. Measured on bpf-next with a stock bpf-gcc, test_progs before and after. Fifteen results go FAIL -> OK -- every test that loads this object, not just the arena ones: stream_arena_fault_address stream_oversize stream_fd stream_fd/blocking stream_partial_read stream_fd/edge stream_fd/empty stream_success stream_fd/hup stream_fd/nmi_epoll stream_success/stream_arena_callback_fault stream_fd/open stream_fd/nonblock stream_success/stream_arena_subprog_fault stream_syscall and the five stream_arena_fault_address subtests become visible for the first time (read, write, xchg, cmpxchg and load_acquire faults). Signed-off-by: Vineet Gupta <[email protected]>
Four stream tests fail with BPF_GCC: test_stream_arena_fault_address:FAIL:stream__open_and_load unexpected error: -13 #479 stream_oversize:FAIL #480 stream_partial_read:FAIL #482 stream_syscall:FAIL They call stream__open_and_load(), which loads every program in the object, and two of those do not verify: #481/11 stream_success/stream_arena_subprog_fault:FAIL #481/12 stream_success/stream_arena_callback_fault:FAIL Both dereference an arena pointer and leave the cast to the compiler: int __arena *addr = (int __arena *)0xdeadbeef; *addr = 1; Without arena support __arena is only btf_type_tag("arena"), so no addr_space_cast is emitted and the store is to a scalar, which the verifier rejects. GCC splits it into byte stores, 0xdeadbeef not being aligned: r2=3735928559 ll *(u8*)(r2+0)=1 <- plain store, no cast Their siblings in the same file do not rely on the compiler; they use bpf_addr_space_cast(), which emits the instruction byte by byte and works anywhere. Do the same here. The address space has to come off the local as well. Left on, a compiler that supports arenas casts a second time for the dereference, on a pointer the explicit cast has already converted: r2 = addr_space_cast(r2, 0, 1) r3 = addr_space_cast(r2, 0, 1) *(u32*)(r3+0)=1 With it off, GCC with and without arena support and clang all emit the same thing, which is what the test wants: r2 = addr_space_cast(r2, 0, 1) *(u32*)(r2+0)=1 What these two assert is the fault report, not how the pointer was produced, so nothing they were testing is lost. Measured on bpf-next with a stock bpf-gcc, test_progs before and after. Fifteen results go FAIL -> OK -- every test that loads this object, not just the arena ones: stream_arena_fault_address stream_oversize stream_fd stream_fd/blocking stream_partial_read stream_fd/edge stream_fd/empty stream_success stream_fd/hup stream_fd/nmi_epoll stream_success/stream_arena_callback_fault stream_fd/open stream_fd/nonblock stream_success/stream_arena_subprog_fault stream_syscall and the five stream_arena_fault_address subtests become visible for the first time (read, write, xchg, cmpxchg and load_acquire faults). Signed-off-by: Vineet Gupta <[email protected]>
Four stream tests fail with BPF_GCC: test_stream_arena_fault_address:FAIL:stream__open_and_load unexpected error: -13 #479 stream_oversize:FAIL #480 stream_partial_read:FAIL #482 stream_syscall:FAIL They call stream__open_and_load(), which loads every program in the object, and two of those do not verify: #481/11 stream_success/stream_arena_subprog_fault:FAIL #481/12 stream_success/stream_arena_callback_fault:FAIL Both dereference an arena pointer and leave the cast to the compiler: int __arena *addr = (int __arena *)0xdeadbeef; *addr = 1; Without arena support __arena is only btf_type_tag("arena"), so no addr_space_cast is emitted and the store is to a scalar, which the verifier rejects. GCC splits it into byte stores, 0xdeadbeef not being aligned: r2=3735928559 ll *(u8*)(r2+0)=1 <- plain store, no cast Their siblings in the same file do not rely on the compiler; they use bpf_addr_space_cast(), which emits the instruction byte by byte and works anywhere. Do the same here. The address space has to come off the local as well. Left on, a compiler that supports arenas casts a second time for the dereference, on a pointer the explicit cast has already converted: r2 = addr_space_cast(r2, 0, 1) r3 = addr_space_cast(r2, 0, 1) *(u32*)(r3+0)=1 With it off, GCC with and without arena support and clang all emit the same thing, which is what the test wants: r2 = addr_space_cast(r2, 0, 1) *(u32*)(r2+0)=1 What these two assert is the fault report, not how the pointer was produced, so nothing they were testing is lost. Measured on bpf-next with a stock bpf-gcc, test_progs before and after. Fifteen results go FAIL -> OK -- every test that loads this object, not just the arena ones: stream_arena_fault_address stream_oversize stream_fd stream_fd/blocking stream_partial_read stream_fd/edge stream_fd/empty stream_success stream_fd/hup stream_fd/nmi_epoll stream_success/stream_arena_callback_fault stream_fd/open stream_fd/nonblock stream_success/stream_arena_subprog_fault stream_syscall and the five stream_arena_fault_address subtests become visible for the first time (read, write, xchg, cmpxchg and load_acquire faults). Signed-off-by: Vineet Gupta <[email protected]>
Four stream tests fail with BPF_GCC: test_stream_arena_fault_address:FAIL:stream__open_and_load unexpected error: -13 #479 stream_oversize:FAIL #480 stream_partial_read:FAIL #482 stream_syscall:FAIL They call stream__open_and_load(), which loads every program in the object, and two of those do not verify: #481/11 stream_success/stream_arena_subprog_fault:FAIL #481/12 stream_success/stream_arena_callback_fault:FAIL Both dereference an arena pointer and leave the cast to the compiler: int __arena *addr = (int __arena *)0xdeadbeef; *addr = 1; Without arena support __arena is only btf_type_tag("arena"), so no addr_space_cast is emitted and the store is to a scalar, which the verifier rejects. GCC splits it into byte stores, 0xdeadbeef not being aligned: r2=3735928559 ll *(u8*)(r2+0)=1 <- plain store, no cast Their siblings in the same file do not rely on the compiler; they use bpf_addr_space_cast(), which emits the instruction byte by byte and works anywhere. Do the same here. The address space has to come off the local as well. Left on, a compiler that supports arenas casts a second time for the dereference, on a pointer the explicit cast has already converted: r2 = addr_space_cast(r2, 0, 1) r3 = addr_space_cast(r2, 0, 1) *(u32*)(r3+0)=1 With it off, GCC with and without arena support and clang all emit the same thing, which is what the test wants: r2 = addr_space_cast(r2, 0, 1) *(u32*)(r2+0)=1 What these two assert is the fault report, not how the pointer was produced, so nothing they were testing is lost. Measured on bpf-next with a stock bpf-gcc, test_progs before and after. Fifteen results go FAIL -> OK -- every test that loads this object, not just the arena ones: stream_arena_fault_address stream_oversize stream_fd stream_fd/blocking stream_partial_read stream_fd/edge stream_fd/empty stream_success stream_fd/hup stream_fd/nmi_epoll stream_success/stream_arena_callback_fault stream_fd/open stream_fd/nonblock stream_success/stream_arena_subprog_fault stream_syscall and the five stream_arena_fault_address subtests become visible for the first time (read, write, xchg, cmpxchg and load_acquire faults). Signed-off-by: Vineet Gupta <[email protected]>
Pull request for series with
subject: bpf: support module BTF in BTF display helpers
version: 2
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=396559