RE: [PATCH bpf 3/3] bpf, sockmap: Fix race between element replace and close()

2024-12-08 Thread John Fastabend
ck *sk_test, >struct sock **psk) > { > - struct sock *sk; > + struct sock *sk = NULL; > int err = 0; > > spin_lock_bh(&stab->lock); > - sk = *psk; > - if (!sk_test || sk_test == sk) > + if (!sk_test || sk_test == *psk) > sk = xchg(psk, NULL); > > if (likely(sk)) > > -- > 2.46.2 > Reviewed-by: John Fastabend

RE: [PATCH bpf 1/3] bpf, sockmap: Fix update element with same

2024-12-08 Thread John Fastabend
sockmap holding a socket, but without the respective > link. This in turn means that close(sock) won't trigger the cleanup, i.e. a > closed socket will not be automatically removed from the sockmap. > > Stop tearing the links when a matching link_raw is found. > > Sign

RE: [PATCH bpf 2/3] selftest/bpf: Extend test for sockmap update with same

2024-12-08 Thread John Fastabend
Michal Luczaj wrote: > Verify that the sockmap link was not severed, and socket's entry is indeed > removed from the map when the corresponding descriptor gets closed. > > Signed-off-by: Michal Luczaj > --- Reviewed-by: John Fastabend

Re: [PATCH bpf 0/4] bpf, vsock: Fix poll() and close()

2024-11-21 Thread John Fastabend
Stefano Garzarella wrote: > On Wed, Nov 20, 2024 at 10:48:25PM -0800, John Fastabend wrote: > >Michal Luczaj wrote: > >> Two small fixes for vsock: poll() missing a queue check, and close() not > >> invoking sockmap cleanup. > >> > >> Signed-off-by:

RE: [PATCH bpf 0/4] bpf, vsock: Fix poll() and close()

2024-11-20 Thread John Fastabend
++ > 2 files changed, 120 insertions(+), 27 deletions(-) > --- > base-commit: 6c4139b0f19b7397286897caee379f8321e78272 > change-id: 20241118-vsock-bpf-poll-close-64f432e682ec > > Best regards, > -- > Michal Luczaj > LGTM, would be nice to get an ack from someone on the vsock side though. Acked-by: John Fastabend

RE: [PATCH net v5] skmsg: skip zero length skb in sk_msg_recvmsg

2024-07-08 Thread John Fastabend
ses it > to kmap_local_page() and to page_address(), then kernel panics. > > To solve this, we should skip this zero length skb. So in sk_msg_recvmsg(), > if copy is zero, that means it's a zero length skb, skip invoking > copy_page_to_iter(). We are using the EFAULT return trigg

RE: [PATCH net v3 1/2] skmsg: prevent empty ingress skb from enqueuing

2024-07-02 Thread John Fastabend
Geliang Tang wrote: > From: Geliang Tang > > Run this BPF selftests (./test_progs -t sockmap_basic) on a Loongarch > platform, a Kernel panic occurs: > > ''' > Oops[#1]: > CPU: 22 PID: 2824 Comm: test_progs Tainted: G OE 6.10.0-rc2+ #18 > Hardware name: LOONGSON Dabieshan/Loongson-TC5

Re: [PATCH bpf-next v2 1/4] skmsg: null check for sg_page in sk_msg_recvmsg

2024-06-25 Thread John Fastabend
Eric Dumazet wrote: > On Tue, Jun 25, 2024 at 10:25 AM Geliang Tang wrote: > > > > From: Geliang Tang > > > > Run the following BPF selftests on Loongarch: > > > > ./test_progs -t sockmap_basic > > > > A Kernel panic occurs: > > > > ''' > > Oops[#1]: > > CPU: 22 PID: 2824 Comm: test_progs Taint

Re: [PATCH bpf-next 3/8] selftests/bpf: Use bpf_link attachments in test_sockmap

2024-05-30 Thread John Fastabend
Geliang Tang wrote: > On Mon, 2024-05-27 at 21:36 +0200, Jakub Sitnicki wrote: > > On Mon, May 27, 2024 at 10:12 AM -07, John Fastabend wrote: > > > Geliang Tang wrote: > > > > From: Geliang Tang > > > > > > > > Switch attachments to bpf_li

RE: [PATCH bpf-next 3/8] selftests/bpf: Use bpf_link attachments in test_sockmap

2024-05-27 Thread John Fastabend
Geliang Tang wrote: > From: Geliang Tang > > Switch attachments to bpf_link using bpf_program__attach_sockmap() instead > of bpf_prog_attach(). Sorry it took me a few days to get to this. Is there a reason to push this to links vs just leave it as is? I had a plan to port all the test_sockmap t

RE: [PATCH bpf-next 7/8] selftests/bpf: Check length of recv in test_sockmap

2024-05-27 Thread John Fastabend
s->bytes_recvd += recv; > + if (recv > 0) > + s->bytes_recvd += recv; > > if (opt->check_recved_len && s->bytes_recvd > > total_bytes) { > errno = EMSGSIZE; > -- > 2.43.0 > Acked-by: John Fastabend

RE: [PATCH bpf-next 8/8] selftests/bpf: Drop duplicate bpf_map_lookup_elem in test_sockmap

2024-05-27 Thread John Fastabend
mp;& *f) > - ret = SK_DROP; > err = bpf_skb_adjust_room(skb, 4, 0, 0); > if (err) > return SK_DROP; > -- > 2.43.0 > Acked-by: John Fastabend

RE: [PATCH bpf-next 6/8] selftests/bpf: Fix size of map_fd in test_sockmap

2024-05-27 Thread John Fastabend
key = next_key = 0; > bpf_map_update_elem(map_fd[i], &key, &zero, BPF_ANY); > while (bpf_map_get_next_key(map_fd[i], &key, &next_key) == 0) { > -- > 2.43.0 > Acked-by: John Fastabend

RE: [PATCH bpf-next 1/8] selftests/bpf: Fix tx_prog_fd values in test_sockmap

2024-05-27 Thread John Fastabend
Geliang Tang wrote: > From: Geliang Tang > > The values of tx_prog_fd in run_options() should not be 0, so set it as -1 > in else branch, and test it using "if (tx_prog_fd > 0)" condition, not > "if (tx_prog_fd)" or "if (tx_prog_fd >= 0)". >

RE: [PATCH bpf-next 2/8] selftests/bpf: Drop duplicate definition of i in test_sockmap

2024-05-27 Thread John Fastabend
Geliang Tang wrote: > From: Geliang Tang > > There's already a definition of i in run_options() at the beginning, no > need to define a new one in "if (tx_prog_fd > 0)" block. > > Signed-off-by: Geliang Tang > --- Acked-by: John Fastabend

RE: [PATCH bpf-next 2/2] selftests/bpf: Free strdup memory in veristat

2024-04-29 Thread John Fastabend
these missing "free(input)" in parse_stats() to avoid > memory leak in veristat.c. > > Signed-off-by: Geliang Tang > --- Acked-by: John Fastabend

RE: [PATCH bpf-next 1/2] selftests/bpf: Free strdup memory in test_sockmap

2024-04-29 Thread John Fastabend
ds these missing "free(ptr)" in check_whitelist() and > check_blacklist() to avoid memory leaks in test_sockmap.c. > > Signed-off-by: Geliang Tang > --- Acked-by: John Fastabend

Re: [PATCH bpf-next] selftests/bpf: Add F_SETFL for fcntl

2024-04-04 Thread John Fastabend
Geliang Tang wrote: > Hi Jakub, > > On Wed, 2024-04-03 at 15:29 -0700, John Fastabend wrote: > > Jakub Sitnicki wrote: > > > Hi Geliang, > > > > > > On Wed, Apr 03, 2024 at 04:32 PM +08, Geliang Tang wrote: > > > > From: Geliang Tang &g

Re: [PATCH bpf-next] selftests/bpf: Add F_SETFL for fcntl

2024-04-03 Thread John Fastabend
Jakub Sitnicki wrote: > Hi Geliang, > > On Wed, Apr 03, 2024 at 04:32 PM +08, Geliang Tang wrote: > > From: Geliang Tang > > > > Incorrect arguments are passed to fcntl() in test_sockmap.c when invoking > > it to set file status flags. If O_NONBLOCK is used as 2nd argument and > > passed into fcn

RE: [PATCH iwl-next,v2 2/2] igc: Add Tx hardware timestamp request for AF_XDP zero-copy packet

2024-03-02 Thread John Fastabend
Song, Yoong Siang wrote: > On Saturday, March 2, 2024 1:55 AM, John Fastabend > wrote: > >Song Yoong Siang wrote: > >> This patch adds support to per-packet Tx hardware timestamp request to > >> AF_XDP zero-copy packet via XDP Tx metadata framework. Please note tha

RE: [PATCH iwl-next,v2 2/2] igc: Add Tx hardware timestamp request for AF_XDP zero-copy packet

2024-03-01 Thread John Fastabend
Song Yoong Siang wrote: > This patch adds support to per-packet Tx hardware timestamp request to > AF_XDP zero-copy packet via XDP Tx metadata framework. Please note that > user needs to enable Tx HW timestamp capability via igc_ioctl() with > SIOCSHWTSTAMP cmd before sending xsk Tx hardware timest

RE: [PATCH iwl-next,v2 1/2] selftests/bpf: xdp_hw_metadata reduce sleep interval

2024-03-01 Thread John Fastabend
usleep(10*1000); > + usleep(10); > } > } > } > -- > 2.34.1 > Acked-by: John Fastabend