Re: Re: [PATCH 2/2] vsock/virtio: Don't reset the created SOCKET during s2r

2025-02-11 Thread Stefano Garzarella
: > > Hello leonardi and stefanha: > > Thanks for your review. And I will add other maintainers CCd in > next push. And I want to discuss more about the second patch. Why are you sending a v2 if we didn't reach an agreement on the second patch? > > > Fi

Re: [PATCH 2/2] vsock/virtio: Don't reset the created SOCKET during s2r

2025-02-10 Thread Stefano Garzarella
On Mon, Feb 10, 2025 at 12:48:03PM +0100, leona...@redhat.com wrote: Like for the other patch, some maintainers have not been CCd. Yes, please use `scripts/get_maintainer.pl`. On Fri, Feb 07, 2025 at 01:20:33PM +0800, Junnan Wu wrote: From: Ying Gao If suspend is executed during vsock

Re: [PATCH 1/2] vsock/virtio: Move rx_buf_nr and rx_buf_max_nr initialization position

2025-02-10 Thread Stefano Garzarella
in virtio_vsock_probe(), but they should be reset whenever virtqueues are recreated, like after a suspend/resume. ... [Desribe the fix, what this patch does] Move the `rx_buf_nr` and `rx_buf_max_nr` initialization in virtio_vsock_vqs_init(), so we are sure that they are properly initializ

Re: [PATCH 2/2] vsock/virtio: Don't reset the created SOCKET during s2r

2025-02-10 Thread leonardi
Like for the other patch, some maintainers have not been CCd. On Fri, Feb 07, 2025 at 01:20:33PM +0800, Junnan Wu wrote: From: Ying Gao If suspend is executed during vsock communication and the socket is reset, the original socket will be unusable after resume. Judge the value of vdev->p

Re: [PATCH 1/2] vsock/virtio: Move rx_buf_nr and rx_buf_max_nr initialization position

2025-02-10 Thread Luigi Leonardi
Hi Junnan, Ying Thank you for the contribution! A few minor comments on the process: I think this series is missing a cover letter, not all the maintainers have been CCd, and you should add the tag net (because it's a fix) to the subject. (e.g. [PATCH net 1/2]). Here you can find

[PATCH 1/2] vsock/virtio: Move rx_buf_nr and rx_buf_max_nr initialization position

2025-02-06 Thread Junnan Wu
From: Ying Gao In function virtio_vsock_probe, it initializes the variables "rx_buf_nr" and "rx_buf_max_nr", but in function virtio_vsock_restore it doesn't. Move the initizalition position into function virtio_vsock_vqs_start. Once executing s2r twice in a row without initializing rx_buf_nr an

[PATCH 2/2] vsock/virtio: Don't reset the created SOCKET during s2r

2025-02-06 Thread Junnan Wu
From: Ying Gao If suspend is executed during vsock communication and the socket is reset, the original socket will be unusable after resume. Judge the value of vdev->priv in function virtio_vsock_vqs_del, only when the function is invoked by virtio_vsock_remove, all vsock connections will be res

Re: [PATCH v3 net 11/16] ipv6: input: convert to dev_net_rcu()

2025-02-05 Thread Eric Dumazet
On Wed, Feb 5, 2025 at 8:57 AM Eric Dumazet wrote: > > > I will squash this diff to the following iteration, and keep rcu_dereference() > > I will shrink the series in V4 to only include known bug fixes, to lower the risk of having 10 more iterations.

Re: [PATCH v3 net 11/16] ipv6: input: convert to dev_net_rcu()

2025-02-04 Thread Eric Dumazet
On Tue, Feb 4, 2025 at 10:30 PM Jakub Kicinski wrote: > > On Tue, 4 Feb 2025 13:17:08 -0800 Paul E. McKenney wrote: > > > > TBH I'm slightly confused by this, and the previous warnings. > > > > > > > > The previous one was from a timer callback. > > > > > > > > This one is with BH disabled. > > >

Re: [PATCH v3 net 11/16] ipv6: input: convert to dev_net_rcu()

2025-02-04 Thread Paul E. McKenney
On Tue, Feb 04, 2025 at 01:30:25PM -0800, Jakub Kicinski wrote: > On Tue, 4 Feb 2025 13:17:08 -0800 Paul E. McKenney wrote: > > > > TBH I'm slightly confused by this, and the previous warnings. > > > > > > > > The previous one was from a timer callback. > > > > > > > > This one is with BH disabled.

Re: [PATCH v3 net 11/16] ipv6: input: convert to dev_net_rcu()

2025-02-04 Thread Jakub Kicinski
On Tue, 4 Feb 2025 13:17:08 -0800 Paul E. McKenney wrote: > > > TBH I'm slightly confused by this, and the previous warnings. > > > > > > The previous one was from a timer callback. > > > > > > This one is with BH disabled. > > > > > > I thought BH implies RCU protection. We certainly depend on tha

Re: [PATCH v3 net 11/16] ipv6: input: convert to dev_net_rcu()

2025-02-04 Thread Paul E. McKenney
On Tue, Feb 04, 2025 at 10:06:15PM +0100, Eric Dumazet wrote: > On Tue, Feb 4, 2025 at 10:00 PM Jakub Kicinski wrote: > > > > On Tue, 4 Feb 2025 21:10:59 +0100 Eric Dumazet wrote: > > > > Test output: > > > > https://netdev-3.bots.linux.dev/vmksft-net-dbg/results/978202/61-l2tp-sh/ > > > > Decoded

Re: [PATCH v3 net 11/16] ipv6: input: convert to dev_net_rcu()

2025-02-04 Thread Jakub Kicinski
On Tue, 4 Feb 2025 21:10:59 +0100 Eric Dumazet wrote: > > Test output: > > https://netdev-3.bots.linux.dev/vmksft-net-dbg/results/978202/61-l2tp-sh/ > > Decoded: > > https://netdev-3.bots.linux.dev/vmksft-net-dbg/results/978202/vm-crash-thr2-0 > > > > Oh well. So many bugs. TBH I'm slightly co

Re: [PATCH v3 net 11/16] ipv6: input: convert to dev_net_rcu()

2025-02-04 Thread Eric Dumazet
On Tue, Feb 4, 2025 at 10:00 PM Jakub Kicinski wrote: > > On Tue, 4 Feb 2025 21:10:59 +0100 Eric Dumazet wrote: > > > Test output: > > > https://netdev-3.bots.linux.dev/vmksft-net-dbg/results/978202/61-l2tp-sh/ > > > Decoded: > > > https://netdev-3.bots.linux.dev/vmksft-net-dbg/results/978202/vm-c

Re: [PATCH net v3 0/6] vsock: Transport reassignment and error handling issues

2025-01-29 Thread patchwork-bot+netdevbpf
entional API feature, a failing connect() making the socket > impossible to use for any subsequent connect() attempts. > > Luigi, I took the opportunity to comment vsock_bind() (patch 3/6), and I've > kept your Reviewed-by. Is this okay? > > [...] Here is the summary with

Re: [PATCH net v3 0/6] vsock: Transport reassignment and error handling issues

2025-01-28 Thread Luigi Leonardi
for any subsequent connect() attempts. Luigi, I took the opportunity to comment vsock_bind() (patch 3/6), and I've kept your Reviewed-by. Is this okay? Hi Michal, Yes, absolutely! Thanks for adding the comment :) Cheers, Luigi Signed-off-by: Michal Luczaj --- Changes in v3: - Rebase - Co

[PATCH net v3 1/6] vsock: Keep the binding until socket destruction

2025-01-28 Thread Michal Luczaj
Preserve sockets bindings; this includes both resulting from an explicit bind() and those implicitly bound through autobind during connect(). Prevents socket unbinding during a transport reassignment, which fixes a use-after-free: 1. vsock_create() (refcnt=1) calls vsock_insert_unbound() (ref

[PATCH net v3 2/6] vsock: Allow retrying on connect() failure

2025-01-28 Thread Michal Luczaj
sk_err is set when a (connectible) connect() fails. Effectively, this makes an otherwise still healthy SS_UNCONNECTED socket impossible to use for any subsequent connection attempts. Clear sk_err upon trying to establish a connection. Fixes: d021c344051a ("VSOCK: Introduce VM Sockets") Reviewed-b

[PATCH net v3 4/6] vsock/test: Introduce vsock_connect_fd()

2025-01-28 Thread Michal Luczaj
Distill timeout-guarded vsock_connect_fd(). Adapt callers. Suggested-by: Stefano Garzarella Reviewed-by: Stefano Garzarella Signed-off-by: Michal Luczaj --- tools/testing/vsock/util.c | 45 + tools/testing/vsock/util.h | 1 + 2 files changed, 18 ins

[PATCH net v3 6/6] vsock/test: Add test for connect() retries

2025-01-28 Thread Michal Luczaj
Deliberately fail a connect() attempt; expect error. Then verify that subsequent attempt (using the same socket) can still succeed, rather than fail outright. Reviewed-by: Stefano Garzarella Reviewed-by: Luigi Leonardi Signed-off-by: Michal Luczaj --- tools/testing/vsock/vsock_test.c | 47

[PATCH net v3 5/6] vsock/test: Add test for UAF due to socket unbinding

2025-01-28 Thread Michal Luczaj
Fail the autobind, then trigger a transport reassign. Socket might get unbound from unbound_sockets, which then leads to a reference count underflow. Reviewed-by: Stefano Garzarella Signed-off-by: Michal Luczaj --- tools/testing/vsock/vsock_test.c | 58

[PATCH net v3 3/6] vsock/test: Introduce vsock_bind()

2025-01-28 Thread Michal Luczaj
Add a helper for socket()+bind(). Adapt callers. Reviewed-by: Stefano Garzarella Reviewed-by: Luigi Leonardi Signed-off-by: Michal Luczaj --- tools/testing/vsock/util.c | 57 +--- tools/testing/vsock/util.h | 1 + tools/testing/vsock/vsock_test.

[PATCH net v3 0/6] vsock: Transport reassignment and error handling issues

2025-01-28 Thread Michal Luczaj
opportunity to comment vsock_bind() (patch 3/6), and I've kept your Reviewed-by. Is this okay? Signed-off-by: Michal Luczaj --- Changes in v3: - Rebase - Comment vsock_bind() (Luigi) - Collect Reviewed-by (Stefano, Luigi) - Link to v2: https://lore.kernel.org/r/20250121-vsock-transport-vs-autobind

Re: [PATCH v6 net-next 11/14] virtio_net: Accurate ECN flag in virtio_net_hdr

2025-01-09 Thread Jason Wang
ingemar.s.johans...@ericsson.com; > >mirja.kuehlew...@ericsson.com; chesh...@apple.com; rs.i...@gmx.at; > >jason_living...@comcast.com; vidhi_g...@apple.com > >Subject: Re: [PATCH v6 net-next 11/14] virtio_net: Accurate ECN flag in > >virtio_net_hd

Re: [PATCH v6 net-next 11/14] virtio_net: Accurate ECN flag in virtio_net_hdr

2025-01-09 Thread Lei Yang
t;mirja.kuehlew...@ericsson.com; chesh...@apple.com; rs.i...@gmx.at; > > >jason_living...@comcast.com; vidhi_g...@apple.com > > >Subject: Re: [PATCH v6 net-next 11/14] virtio_net: Accurate ECN flag in > > >virtio_net_hdr > > > > > >[You don't often

Re: [PATCH v6 net-next 11/14] virtio_net: Accurate ECN flag in virtio_net_hdr

2025-01-08 Thread Michael S. Tsirkin
labs.com; ingemar.s.johans...@ericsson.com; > >mirja.kuehlew...@ericsson.com; chesh...@apple.com; rs.i...@gmx.at; > >jason_living...@comcast.com; vidhi_g...@apple.com > >Subject: Re: [PATCH v6 net-next 11/14] virtio_net: Accurate ECN flag in > >virtio_net_hdr &

RE: [PATCH v6 net-next 11/14] virtio_net: Accurate ECN flag in virtio_net_hdr

2024-12-30 Thread Chia-Yu Chang (Nokia)
.alibaba.com; epere...@redhat.com; >virtualizat...@lists.linux.dev; i...@kernel.org; ncardw...@google.com; Koen De >Schepper (Nokia) ; >g.wh...@cablelabs.com; ingemar.s.johans...@ericsson.com; >mirja.kuehlew...@ericsson.com; chesh...@apple.com; rs.i...@gmx.at; >jason_living...@comcast.com;

Re: [PATCH v6 net-next 11/14] virtio_net: Accurate ECN flag in virtio_net_hdr

2024-12-29 Thread Jason Wang
/debugfs.c | 6 ++ > include/linux/virtio_net.h | 16 ++-- > include/uapi/linux/virtio_net.h | 5 + > 4 files changed, 32 insertions(+), 9 deletions(-) Is there a link to the spec patch? It needs to be accepted first. Thanks

Re: [PATCH v6 net-next 00/14] AccECN protocol preparation patch series

2024-12-27 Thread Jakub Kicinski
On Fri, 27 Dec 2024 20:11:57 +0100 chia-yu.ch...@nokia-bell-labs.com wrote: > Hello Hello. Someone may still review, but: ## Form letter - winter-break Networking development is suspended for winter holidays, until Jan 2nd. We are currently accepting bug fixes only, see the announcements at: h

[PATCH v6 net-next 13/14] tcp: add new TCP_TW_ACK_OOW state and allow ECN bits in TOS

2024-12-27 Thread chia-yu . chang
From: Ilpo Järvinen ECN bits in TOS are always cleared when sending in ACKs in TW. Clearing them is problematic for TCP flows that used Accurate ECN because ECN bits decide which service queue the packet is placed into (L4S vs Classic). Effectively, TW ACKs are always downgraded from L4S to Class

[PATCH v6 net-next 10/14] net: hns3/mlx5e: avoid corrupting CWR flag when receiving GRO packet

2024-12-27 Thread chia-yu . chang
From: Chia-Yu Chang In Accurate ECN, ACE counter (AE, ECE, CWR flags) changes only when new CE packets arrive, while setting SKB_GSO_TCP_ECN in case of not knowing the ECN variant can result in header change that corrupts the ACE field. The new flag SKB_GSO_TCP_ACCECN is to prevent SKB_GSO_TCP_EC

[PATCH v6 net-next 14/14] tcp: Pass flags to __tcp_send_ack

2024-12-27 Thread chia-yu . chang
From: Ilpo Järvinen Accurate ECN needs to send custom flags to handle IP-ECN field reflection during handshake. Signed-off-by: Ilpo Järvinen Signed-off-by: Chia-Yu Chang Reviewed-by: Eric Dumazet --- include/net/tcp.h | 2 +- net/ipv4/bpf_tcp_ca.c | 2 +- net/ipv4/tcp_dctcp.h | 2 +- ne

[PATCH v6 net-next 11/14] virtio_net: Accurate ECN flag in virtio_net_hdr

2024-12-27 Thread chia-yu . chang
From: Chia-Yu Chang Unlike RFC 3168 ECN, accurate ECN uses the CWR flag as part of the ACE field to count new packets with CE mark; however, it will be corrupted by the RFC 3168 ECN-aware TSO. Therefore, fallback shall be applied by seting NETIF_F_GSO_ACCECN to ensure that the CWR flag should not

[PATCH v6 net-next 12/14] tcp: AccECN support to tcp_add_backlog

2024-12-27 Thread chia-yu . chang
From: Ilpo Järvinen AE flag needs to be preserved for AccECN. Signed-off-by: Ilpo Järvinen Signed-off-by: Chia-Yu Chang Reviewed-by: Eric Dumazet --- net/ipv4/tcp_ipv4.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index b0b8

[PATCH v6 net-next 08/14] gso: AccECN support

2024-12-27 Thread chia-yu . chang
should be evaluated per NIC basis (not done in this patch series for any NICs). For the cases, where TSO cannot keep its hands off the CWR flag, a GSO fallback is provided by this patch. Signed-off-by: Ilpo Järvinen Signed-off-by: Chia-Yu Chang Reviewed-by: Eric Dumazet --- incl

[PATCH v6 net-next 07/14] tcp: helpers for ECN mode handling

2024-12-27 Thread chia-yu . chang
From: Ilpo Järvinen Create helpers for TCP ECN modes. No functional changes. Signed-off-by: Ilpo Järvinen Signed-off-by: Chia-Yu Chang Reviewed-by: Eric Dumazet --- include/net/tcp.h| 44 net/ipv4/tcp.c | 2 +- net/ipv4/tcp_dctcp.c

[PATCH v6 net-next 09/14] gro: prevent ACE field corruption & better AccECN handling

2024-12-27 Thread chia-yu . chang
From: Ilpo Järvinen There are important differences in how the CWR field behaves in RFC3168 and AccECN. With AccECN, CWR flag is part of the ACE counter and its changes are important so adjust the flags changed mask accordingly. Also, if CWR is there, set the Accurate ECN GSO flag to avoid corru

[PATCH v6 net-next 04/14] tcp: extend TCP flags to allow AE bit/ACE field

2024-12-27 Thread chia-yu . chang
From: Ilpo Järvinen With AccECN, there's one additional TCP flag to be used (AE) and ACE field that overloads the definition of AE, CWR, and ECE flags. As tcp_flags was previously only 1 byte, the byte-order stuff needs to be added to it's handling. Signed-off-by: Ilpo Järvinen Signed-off-by: C

[PATCH v6 net-next 06/14] tcp: rework {__,}tcp_ecn_check_ce() -> tcp_data_ecn_check()

2024-12-27 Thread chia-yu . chang
From: Ilpo Järvinen Rename tcp_ecn_check_ce to tcp_data_ecn_check as it is called only for data segments, not for ACKs (with AccECN, also ACKs may get ECN bits). The extra "layer" in tcp_ecn_check_ce() function just checks for ECN being enabled, that can be moved into tcp_ecn_field_check rather

[PATCH v6 net-next 05/14] tcp: reorganize SYN ECN code

2024-12-27 Thread chia-yu . chang
From: Ilpo Järvinen Prepare for AccECN that needs to have access here on IP ECN field value which is only available after INET_ECN_xmit(). No functional changes. Signed-off-by: Ilpo Järvinen Signed-off-by: Chia-Yu Chang Reviewed-by: Eric Dumazet --- net/ipv4/tcp_output.c | 5 +++-- 1 file c

[PATCH v6 net-next 03/14] tcp: use BIT() macro in include/net/tcp.h

2024-12-27 Thread chia-yu . chang
From: Chia-Yu Chang Use BIT() macro for TCP flags field and TCP congestion control flags that will be used by the congestion control algorithm. No functional changes. Signed-off-by: Chia-Yu Chang Reviewed-by: Ilpo Järvinen Reviewed-by: Eric Dumazet --- include/net/tcp.h | 21 +++

[PATCH v6 net-next 02/14] tcp: create FLAG_TS_PROGRESS

2024-12-27 Thread chia-yu . chang
From: Ilpo Järvinen Whenever timestamp advances, it declares progress which can be used by the other parts of the stack to decide that the ACK is the most recent one seen so far. AccECN will use this flag when deciding whether to use the ACK to update AccECN state or not. Signed-off-by: Ilpo Jä

[PATCH v6 net-next 01/14] tcp: reorganize tcp_in_ack_event() and tcp_count_delivered()

2024-12-27 Thread chia-yu . chang
From: Ilpo Järvinen - Move tcp_count_delivered() earlier and split tcp_count_delivered_ce() out of it - Move tcp_in_ack_event() later - While at it, remove the inline from tcp_in_ack_event() and let the compiler to decide Accurate ECN's heuristics does not know if there is going to be ACE fi

[PATCH v6 net-next 00/14] AccECN protocol preparation patch series

2024-12-27 Thread chia-yu . chang
From: Chia-Yu Chang Hello, Specific changes in v6 (27-Dec-2024) - Avoid removing removing the potential CA_ACK_WIN_UPDATE in ack_ev_flags of patch #1 (Eric Dumazet ) - Add reviewed-by tag in patches #2, #3, #4, #5, #6, #7, #8, #12, #14 - Foloiwng 2 new pathces are added after patch #9 (Patch

Re: [PATCH] vsock/virtio: Fix null-ptr-deref in vsock_stream_has_data

2024-12-20 Thread Michal Luczaj
On 12/20/24 11:49, Stefano Garzarella wrote: > ... > Note that non-NULL -> NULL should only occur before a connection is > established, so before any data is passed. Is this a problem for BPF? Please take a look at vsock_bpf_update_proto(). The condition is to have a transport assigned. BPF assum

Re: [PATCH] vsock/virtio: Fix null-ptr-deref in vsock_stream_has_data

2024-12-20 Thread Stefano Garzarella
apply your virtio_transport_recv_pkt() patch *and* make it impossible-by-design to switch ->transport from non-NULL to NULL in vsock_assign_transport(). I don't know if that's enough, in this case the problem is that some response packets are intended for a socket, where the transport has c

Re: [PATCH] vsock/virtio: Fix null-ptr-deref in vsock_stream_has_data

2024-12-19 Thread Michal Luczaj
virtio-vsock), it's also >>>>> important that the transport is the same. >>>> >>>> My vote would be to apply your virtio_transport_recv_pkt() patch *and* make >>>> it impossible-by-design to switch ->transport from non-NULL to NULL in >>>> vsock_

Re: [PATCH] vsock/virtio: Fix null-ptr-deref in vsock_stream_has_data

2024-12-19 Thread Stefano Garzarella
est thing though is to better understand how to handle > >>> deassign, rather than checking everywhere that it's not null, also > >>> because in some cases (like the one in virtio-vsock), it's also > >>> important that the transport is the same. > &g

Re: [PATCH] vsock/virtio: Fix null-ptr-deref in vsock_stream_has_data

2024-12-19 Thread Michal Luczaj
han checking everywhere that it's not null, also >>> because in some cases (like the one in virtio-vsock), it's also >>> important that the transport is the same. >> >> My vote would be to apply your virtio_transport_recv_pkt() patch *and* make >> it impos

Re: [PATCH] vsock/virtio: Fix null-ptr-deref in vsock_stream_has_data

2024-12-19 Thread Stefano Garzarella
ause in some cases (like the one in virtio-vsock), it's also > > important that the transport is the same. > > My vote would be to apply your virtio_transport_recv_pkt() patch *and* make > it impossible-by-design to switch ->transport from non-NULL to NULL in > vsock_assign_

Re: [PATCH] vsock/virtio: Fix null-ptr-deref in vsock_stream_has_data

2024-12-19 Thread Michal Luczaj
that the transport is the same. My vote would be to apply your virtio_transport_recv_pkt() patch *and* make it impossible-by-design to switch ->transport from non-NULL to NULL in vsock_assign_transport(). If I'm not mistaken, that would require rewriting vsock_assign_transport() so that a ne

Re: [PATCH] vsock/virtio: Fix null-ptr-deref in vsock_stream_has_data

2024-12-19 Thread Stefano Garzarella
sed before lock_sock */ >>> - if (sock_flag(sk, SOCK_DONE)) { >>> + /* Check if sk has been closed or assigned to another transport before >>> +* lock_sock >>> +*/ >>> + if (sock_flag(sk, SOCK_DONE) || vsk->transport != &t->t

Re: [PATCH] vsock/virtio: Fix null-ptr-deref in vsock_stream_has_data

2024-12-18 Thread Hyunwoo Kim
; +*/ > >>> + if (sock_flag(sk, SOCK_DONE) || vsk->transport != &t->transport) { > >>>(void)virtio_transport_reset_no_sock(t, skb); > >>>release_sock(sk); > >>>sock_put(sk); > >

Re: [PATCH] vsock/virtio: Fix null-ptr-deref in vsock_stream_has_data

2024-12-18 Thread Michal Luczaj
eck if sk has been closed or assigned to another transport >>> before >>> +* lock_sock >>> +*/ >>> + if (sock_flag(sk, SOCK_DONE) || vsk->transport != &t->transport) { >>>(void)virtio_transport_reset_no_sock(t, skb); >

Re: [PATCH] vsock/virtio: Fix null-ptr-deref in vsock_stream_has_data

2024-12-18 Thread Hyunwoo Kim
> > @@ -1628,8 +1628,10 @@ void virtio_transport_recv_pkt(struct > > > > virtio_transport *t, > > > > > > > >lock_sock(sk); > > > > > > > > - /* Check if sk has been closed before lock_sock */ > > > > -

Re: [PATCH] vsock/virtio: Fix null-ptr-deref in vsock_stream_has_data

2024-12-18 Thread Stefano Garzarella
(void)virtio_transport_reset_no_sock(t, skb); release_sock(sk); sock_put(sk); And separately, I think applying the vsock_stream_has_data patch would help prevent potential issues that could arise when vsock_stream_has_data is called somewhere. Not sure, with t

Re: [PATCH] vsock/virtio: Fix null-ptr-deref in vsock_stream_has_data

2024-12-18 Thread Stefano Garzarella
_transport *t, lock_sock(sk); - /* Check if sk has been closed before lock_sock */ - if (sock_flag(sk, SOCK_DONE)) { + /* Check if sk has been closed or assigned to another transport before +* lock_sock +*/ + if (sock_flag(sk, SOCK_DONE) || vsk->

Re: [PATCH] vsock/virtio: Fix null-ptr-deref in vsock_stream_has_data

2024-12-18 Thread Hyunwoo Kim
lock_sock(sk); > > - /* Check if sk has been closed before lock_sock */ > - if (sock_flag(sk, SOCK_DONE)) { > + /* Check if sk has been closed or assigned to another transport before > +* lock_sock > +*/ > + if (sock_flag(sk,

Re: [PATCH] vsock/virtio: Fix null-ptr-deref in vsock_stream_has_data

2024-12-18 Thread Stefano Garzarella
On Wed, Dec 18, 2024 at 07:25:07AM -0500, Hyunwoo Kim wrote: When calling connect to change the CID of a vsock, the loopback worker for the VIRTIO_VSOCK_OP_RST command is invoked. During this process, vsock_stream_has_data() calls vsk->transport->stream_has_data(). However, a null-ptr-deref occur

[PATCH] vsock/virtio: Fix null-ptr-deref in vsock_stream_has_data

2024-12-18 Thread Hyunwoo Kim
When calling connect to change the CID of a vsock, the loopback worker for the VIRTIO_VSOCK_OP_RST command is invoked. During this process, vsock_stream_has_data() calls vsk->transport->stream_has_data(). However, a null-ptr-deref occurs because vsk->transport was set to NULL in vsock_deassign_tran

Re: [PATCH net v2 0/3] virtio/vsock: Fix memory leaks

2024-12-06 Thread Michal Luczaj
On 11/19/24 11:31, Stefano Garzarella wrote: > Hi Michal, > > On Thu, Nov 07, 2024 at 09:46:11PM +0100, Michal Luczaj wrote: >> Short series fixing some memory leaks that I've stumbled upon while >> toying >> with the selftests. > > Are these tests already upstream? > I would like to add them to

Re: [PATCH net v2 0/3] virtio/vsock: Fix memory leaks

2024-11-19 Thread Stefano Garzarella
efano Signed-off-by: Michal Luczaj --- Changes in v2: - Remove the refactoring patch from the series [Stefano] - PATCH 2: Drop "virtio" from the commit title [Stefano] - Collect Reviewed-by [Stefano] - Link to v1: https://lore.kernel.org/r/20241106-vsock-mem-leaks-v1-0-8f4ffc309...@rbox

Re: [PATCH net-next v4 00/13] virtio-net: support AF_XDP zero copy (tx)

2024-11-15 Thread patchwork-bot+netdevbpf
Hello: This series was applied to netdev/net-next.git (main) by Jakub Kicinski : On Tue, 12 Nov 2024 09:29:15 +0800 you wrote: > v4: > 1. rebase net-next > 2. update the kdoc for the new APIs > > v3: > 1. use sg_dma_address/length api to set the premapped sg > 2. remove 'premappe

RE: [PATCH v5 net-next 09/13] gro: prevent ACE field corruption & better AccECN handling

2024-11-13 Thread Chia-Yu Chang (Nokia)
om; ingemar.s.johans...@ericsson.com; >mirja.kuehlew...@ericsson.com; chesh...@apple.com; rs.i...@gmx.at; >jason_living...@comcast.com; vidhi_g...@apple.com >Subject: Re: [PATCH v5 net-next 09/13] gro: prevent ACE field corruption & >better AccECN handling > >[You don't often ge

Re: [PATCH v5 net-next 09/13] gro: prevent ACE field corruption & better AccECN handling

2024-11-12 Thread Jason Wang
rja.kuehlew...@ericsson.com; > > >chesh...@apple.com; rs.i...@gmx.at; jason_living...@comcast.com; > > >vidhi_g...@apple.com > > >Subject: Re: [PATCH v5 net-next 09/13] gro: prevent ACE field corruption & > > >better AccECN handling > > >

RE: [PATCH v5 net-next 09/13] gro: prevent ACE field corruption & better AccECN handling

2024-11-12 Thread Ilpo Järvinen
@netfilter.org; ncardw...@google.com; Koen De Schepper (Nokia) > >; g.wh...@cablelabs.com; > >ingemar.s.johans...@ericsson.com; mirja.kuehlew...@ericsson.com; > >chesh...@apple.com; rs.i...@gmx.at; jason_living...@comcast.com; > >vidhi_g...@apple.com > >Subject:

Re: [PATCH net v2 0/3] virtio/vsock: Fix memory leaks

2024-11-12 Thread patchwork-bot+netdevbpf
s in v2: > - Remove the refactoring patch from the series [Stefano] > - PATCH 2: Drop "virtio" from the commit title [Stefano] > - Collect Reviewed-by [Stefano] > - Link to v1: > https://lore.kernel.org/r/20241106-vsock-mem-leaks-v1-0-8f4ffc309...@rbox.co > > [...] H

[PATCH net-next v4 09/13] virtio_net: xsk: bind/unbind xsk for tx

2024-11-11 Thread Xuan Zhuo
This patch implement the logic of bind/unbind xsk pool to sq and rq. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/net/virtio_net.c | 53 1 file changed, 53 insertions(+) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c

[PATCH net-next v4 11/13] virtio_net: xsk: tx: support xmit xsk buffer

2024-11-11 Thread Xuan Zhuo
The driver's tx napi is very important for XSK. It is responsible for obtaining data from the XSK queue and sending it out. At the beginning, we need to trigger tx napi. virtnet_free_old_xmit distinguishes three type ptr(skb, xdp frame, xsk buffer) by the last bits of the pointer. Signed-off-by:

[PATCH net-next v4 10/13] virtio_net: xsk: prevent disable tx napi

2024-11-11 Thread Xuan Zhuo
Since xsk's TX queue is consumed by TX NAPI, if sq is bound to xsk, then we must stop tx napi from being disabled. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/net/virtio_net.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/net/virtio_net.c b/

[PATCH net-next v4 13/13] virtio_net: xdp_features add NETDEV_XDP_ACT_XSK_ZEROCOPY

2024-11-11 Thread Xuan Zhuo
Now, we support AF_XDP(xsk). Add NETDEV_XDP_ACT_XSK_ZEROCOPY to xdp_features. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/net/virtio_net.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 7db586770249..

[PATCH net-next v4 06/13] virtio-net: rq submits premapped per-buffer

2024-11-11 Thread Xuan Zhuo
virtio-net rq submits premapped per-buffer by setting sg page to NULL; Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/net/virtio_net.c | 22 +++--- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c inde

[PATCH net-next v4 12/13] virtio_net: update tx timeout record

2024-11-11 Thread Xuan Zhuo
If send queue sent some packets, we update the tx timeout record to prevent the tx timeout. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/net/virtio_net.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 57642bd83b7

[PATCH net-next v4 01/13] virtio_ring: introduce vring_need_unmap_buffer

2024-11-11 Thread Xuan Zhuo
To make the code readable, introduce vring_need_unmap_buffer() to replace do_unmap. use_dma_api premapped -> vring_need_unmap_buffer() 1. false falsefalse 2. truefalsetrue 3. truetrue false Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drive

[PATCH net-next v4 05/13] virtio_ring: introduce add api for premapped

2024-11-11 Thread Xuan Zhuo
Two APIs are introduced to submit premapped per-buffers. int virtqueue_add_inbuf_premapped(struct virtqueue *vq, struct scatterlist *sg, unsigned int num, void *data, void *ctx,

[PATCH net-next v4 04/13] virtio_ring: perform premapped operations based on per-buffer

2024-11-11 Thread Xuan Zhuo
The current configuration sets the virtqueue (vq) to premapped mode, implying that all buffers submitted to this queue must be mapped ahead of time. This presents a challenge for the virtnet send queue (sq): the virtnet driver would be required to keep track of dma information for vq size * 17, whi

[PATCH net-next v4 08/13] virtio_net: refactor the xmit type

2024-11-11 Thread Xuan Zhuo
Because the af-xdp will introduce a new xmit type, so I refactor the xmit type mechanism first. We know both xdp_frame and sk_buff are at least 4 bytes aligned. For the xdp tx, we do not pass any pointer to virtio core as data, we just need to pass the len of the packet. So we will push len to the

[PATCH net-next v4 00/13] virtio-net: support AF_XDP zero copy (tx)

2024-11-11 Thread Xuan Zhuo
2. fix the gcc error for commit #3 3. use virtqueue_dma_ for tx hdr 4. rename virtnet_ptr_to_xsk to virtnet_ptr_to_xsk_buff_len 5. squash #11 in last patch set to #10 ## AF_XDP XDP soc

[PATCH net-next v4 07/13] virtio_ring: remove API virtqueue_set_dma_premapped

2024-11-11 Thread Xuan Zhuo
Now, this API is useless. remove it. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/net/virtio_net.c | 13 -- drivers/virtio/virtio_ring.c | 48 include/linux/virtio.h | 2 -- 3 files changed, 63 deletions(-) diff --git a/drive

[PATCH net-next v4 02/13] virtio_ring: split: record extras for indirect buffers

2024-11-11 Thread Xuan Zhuo
The subsequent commit needs to know whether every indirect buffer is premapped or not. So we need to introduce an extra struct for every indirect buffer to record this info. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/virtio/virtio_ring.c | 112 ---

[PATCH net-next v4 03/13] virtio_ring: packed: record extras for indirect buffers

2024-11-11 Thread Xuan Zhuo
The subsequent commit needs to know whether every indirect buffer is premapped or not. So we need to introduce an extra struct for every indirect buffer to record this info. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/virtio/virtio_ring.c | 60 +---

Re: [PATCH net-next v3 05/13] virtio_ring: introduce add api for premapped

2024-11-11 Thread Jakub Kicinski
On Thu, 7 Nov 2024 16:54:56 +0800 Xuan Zhuo wrote: > + * Returns zero or a negative error (ie. ENOSPC, ENOMEM, EIO). > + * Returns zero or a negative error (ie. ENOSPC, ENOMEM, EIO). Looks like we need a rebase, doesn't apply any more. When you rebase please correct the kdoc, looks like the off

Re: [PATCH net v2 2/3] vsock: Fix sk_error_queue memory leak

2024-11-11 Thread Arseniy Krasnov
On 07.11.2024 23:46, Michal Luczaj wrote: > Kernel queues MSG_ZEROCOPY completion notifications on the error queue. > Where they remain, until explicitly recv()ed. To prevent memory leaks, > clean up the queue when the socket is destroyed. > > unreferenced object 0x8881028beb00 (size 224):

Re: [PATCH net v2 3/3] virtio/vsock: Improve MSG_ZEROCOPY error handling

2024-11-11 Thread Arseniy Krasnov
On 07.11.2024 23:46, Michal Luczaj wrote: > Add a missing kfree_skb() to prevent memory leaks. > > Fixes: 581512a6dc93 ("vsock/virtio: MSG_ZEROCOPY flag support") > Reviewed-by: Stefano Garzarella > Signed-off-by: Michal Luczaj > --- > net/vmw_vsock/virtio_transport_common.c | 1 + > 1 file

Re: [PATCH net 3/4] virtio/vsock: Improve MSG_ZEROCOPY error handling

2024-11-11 Thread Arseniy Krasnov
On 06.11.2024 20:51, Michal Luczaj wrote: > Add a missing kfree_skb() to prevent memory leaks. > > Fixes: 581512a6dc93 ("vsock/virtio: MSG_ZEROCOPY flag support") > Signed-off-by: Michal Luczaj > --- > net/vmw_vsock/virtio_transport_common.c | 1 + > 1 file changed, 1 insertion(+) Acked-by:

Re: [PATCH net-next v3 03/13] virtio_ring: packed: record extras for indirect buffers

2024-11-10 Thread Jason Wang
On Mon, Nov 11, 2024 at 11:53 AM Xuan Zhuo wrote: > > On Thu, 7 Nov 2024 16:54:54 +0800, Xuan Zhuo > wrote: > > The subsequent commit needs to know whether every indirect buffer is > > premapped or not. So we need to introduce an extra struct for every > > indirect buffer to record this info. >

Re: [PATCH net-next v3 03/13] virtio_ring: packed: record extras for indirect buffers

2024-11-10 Thread Xuan Zhuo
On Thu, 7 Nov 2024 16:54:54 +0800, Xuan Zhuo wrote: > The subsequent commit needs to know whether every indirect buffer is > premapped or not. So we need to introduce an extra struct for every > indirect buffer to record this info. > > Signed-off-by: Xuan Zhuo Hi, Jason This also needs a rev

Re: [PATCH net-next v3 06/13] virtio-net: rq submits premapped per-buffer

2024-11-10 Thread Jason Wang
On Thu, Nov 7, 2024 at 4:55 PM Xuan Zhuo wrote: > > virtio-net rq submits premapped per-buffer by setting sg page to NULL; > > Signed-off-by: Xuan Zhuo > --- > drivers/net/virtio_net.c | 22 +++--- > 1 file changed, 11 insertions(+), 11 deletions(-) > > diff --git a/drivers/net/v

Re: [PATCH net-next v3 05/13] virtio_ring: introduce add api for premapped

2024-11-10 Thread Jason Wang
On Thu, Nov 7, 2024 at 4:55 PM Xuan Zhuo wrote: > > Two APIs are introduced to submit premapped per-buffers. > > int virtqueue_add_inbuf_premapped(struct virtqueue *vq, > struct scatterlist *sg, unsigned int num, > void *data, >

Re: [PATCH net-next v3 02/13] virtio_ring: split: record extras for indirect buffers

2024-11-10 Thread Jason Wang
On Thu, Nov 7, 2024 at 4:55 PM Xuan Zhuo wrote: > > The subsequent commit needs to know whether every indirect buffer is > premapped or not. So we need to introduce an extra struct for every > indirect buffer to record this info. > > Signed-off-by: Xuan Zhuo Acked-by: Jason Wang Thanks

Re: [PATCH net-next v2 02/13] virtio_ring: split: record extras for indirect buffers

2024-11-10 Thread Jason Wang
; I meant for hardening we need to check the flags stored in the extra > > instead of the descriptor itself as it could be mangled by the device. > > > > Thanks > > Good point. Jason, want to cook up a patch? Will do. Thanks > > -- > MST >

Re: [PATCH net 4/4] virtio/vsock: Put vsock_connected_sockets_vsk() to use

2024-11-08 Thread Stefano Garzarella
vsock_insert_connected() where it's been open-coded. No functional change intended. Fixes: d021c344051a ("VSOCK: Introduce VM Sockets") This is not a fix, so please remove the Fixes tag, we don't need to backport this patch in stable branches. Also in this case this is not relate

Re: [PATCH net v2 2/3] vsock: Fix sk_error_queue memory leak

2024-11-08 Thread Stefano Garzarella
On Thu, Nov 07, 2024 at 09:46:13PM +0100, Michal Luczaj wrote: Kernel queues MSG_ZEROCOPY completion notifications on the error queue. Where they remain, until explicitly recv()ed. To prevent memory leaks, clean up the queue when the socket is destroyed. unreferenced object 0x8881028beb00 (s

Re: [PATCH net 4/4] virtio/vsock: Put vsock_connected_sockets_vsk() to use

2024-11-07 Thread Michal Luczaj
been open-coded. >> >> No functional change intended. >> >> Fixes: d021c344051a ("VSOCK: Introduce VM Sockets") > > This is not a fix, so please remove the Fixes tag, we don't need to > backport this patch in stable branches. > > Also in this ca

[PATCH net v2 0/3] virtio/vsock: Fix memory leaks

2024-11-07 Thread Michal Luczaj
Short series fixing some memory leaks that I've stumbled upon while toying with the selftests. Signed-off-by: Michal Luczaj --- Changes in v2: - Remove the refactoring patch from the series [Stefano] - PATCH 2: Drop "virtio" from the commit title [Stefano] - Collect Reviewed-by [

Re: [PATCH net 2/4] virtio/vsock: Fix sk_error_queue memory leak

2024-11-07 Thread Michal Luczaj
On 11/7/24 11:17, Stefano Garzarella wrote: > On Wed, Nov 06, 2024 at 06:51:19PM +0100, Michal Luczaj wrote: >> Kernel queues MSG_ZEROCOPY completion notifications on the error queue. >> Where they remain, until explicitly recv()ed. To prevent memory leaks, >> clean up the queue when the socket is

[PATCH net v2 1/3] virtio/vsock: Fix accept_queue memory leak

2024-11-07 Thread Michal Luczaj
As the final stages of socket destruction may be delayed, it is possible that virtio_transport_recv_listen() will be called after the accept_queue has been flushed, but before the SOCK_DONE flag has been set. As a result, sockets enqueued after the flush would remain unremoved, leading to a memory

[PATCH net v2 3/3] virtio/vsock: Improve MSG_ZEROCOPY error handling

2024-11-07 Thread Michal Luczaj
Add a missing kfree_skb() to prevent memory leaks. Fixes: 581512a6dc93 ("vsock/virtio: MSG_ZEROCOPY flag support") Reviewed-by: Stefano Garzarella Signed-off-by: Michal Luczaj --- net/vmw_vsock/virtio_transport_common.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/vmw_vsock/virtio_tr

[PATCH net v2 2/3] vsock: Fix sk_error_queue memory leak

2024-11-07 Thread Michal Luczaj
Kernel queues MSG_ZEROCOPY completion notifications on the error queue. Where they remain, until explicitly recv()ed. To prevent memory leaks, clean up the queue when the socket is destroyed. unreferenced object 0x8881028beb00 (size 224): comm "vsock_test", pid 1218, jiffies 4294694897 hex

Re: [PATCH net 4/4] virtio/vsock: Put vsock_connected_sockets_vsk() to use

2024-11-07 Thread Stefano Garzarella
quot;VSOCK: Introduce VM Sockets") This is not a fix, so please remove the Fixes tag, we don't need to backport this patch in stable branches. Also in this case this is not related at all with virtio transport, so please remove `virtio` from the commit title. In addition maybe you can re

  1   2   3   4   5   6   7   8   9   10   >