lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 2 Apr 2024 18:23:32 +0200
From: Eric Dumazet <edumazet@...gle.com>
To: shironeko@...aguri.club, Jose Alonso <joalonsof@...il.com>
Cc: "David S . Miller" <davem@...emloft.net>, Jakub Kicinski <kuba@...nel.org>, 
	Paolo Abeni <pabeni@...hat.com>, netdev@...r.kernel.org, 
	Soheil Hassas Yeganeh <soheil@...gle.com>, Neal Cardwell <ncardwell@...gle.com>, 
	Yuchung Cheng <ycheng@...gle.com>, eric.dumazet@...il.com
Subject: Re: [PATCH net-next] tcp: get rid of sysctl_tcp_adv_win_scale

On Tue, Apr 2, 2024 at 5:50 PM Eric Dumazet <edumazet@...gle.com> wrote:
>
> On Tue, Apr 2, 2024 at 5:28 PM <shironeko@...aguri.club> wrote:
> >
> > Hi all,
> >
> > These parts seems to be causing a regression for a specific USB NIC, I
> > have this on one of home server, and it's network will randomly cut out
> > a few times a week.
> > Seems others have ran into the same issue with this particular NIC as
> > well https://bugzilla.kernel.org/show_bug.cgi?id=218536
> >
> > > +/* inverse of tcp_win_from_space() */
> > > +static inline int tcp_space_from_win(const struct sock *sk, int win)
> > > +{
> > > +     u64 val = (u64)win << TCP_RMEM_TO_WIN_SCALE;
> > > +
> > > +     do_div(val, tcp_sk(sk)->scaling_ratio);
> > > +     return val;
> > > +}
> > > +
> > > +static inline void tcp_scaling_ratio_init(struct sock *sk)
> > > +{
> > > +     /* Assume a conservative default of 1200 bytes of payload per 4K
> > > page.
> > > +      * This may be adjusted later in tcp_measure_rcv_mss().
> > > +      */
> > > +     tcp_sk(sk)->scaling_ratio = (1200 << TCP_RMEM_TO_WIN_SCALE) /
> > > +                                 SKB_TRUESIZE(4096);
> > >  }
> > ...
> > > @@ -740,12 +750,7 @@ void tcp_rcv_space_adjust(struct sock *sk)
> > >               do_div(grow, tp->rcvq_space.space);
> > >               rcvwin += (grow << 1);
> > >
> > > -             rcvmem = SKB_TRUESIZE(tp->advmss + MAX_TCP_HEADER);
> > > -             while (tcp_win_from_space(sk, rcvmem) < tp->advmss)
> > > -                     rcvmem += 128;
> > > -
> > > -             do_div(rcvwin, tp->advmss);
> > > -             rcvbuf = min_t(u64, rcvwin * rcvmem,
> > > +             rcvbuf = min_t(u64, tcp_space_from_win(sk, rcvwin),
> > >                              READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_rmem[2]));
> > >               if (rcvbuf > sk->sk_rcvbuf) {
> > >                       WRITE_ONCE(sk->sk_rcvbuf, rcvbuf);
> >
> > The NIC:
> > usb 2-2: new SuperSpeed USB device number 4 using xhci_hcd
> > usb 2-2: New USB device found, idVendor=0b95, idProduct=1790, bcdDevice=
> > 1.00
> > usb 2-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
> > usb 2-2: Product: AX88179
> > usb 2-2: Manufacturer: ASIX Elec. Corp.
> > usb 2-2: SerialNumber: 0000000000009D
> > ax88179_178a 2-2:1.0 eth0: register 'ax88179_178a' at
> > usb-0000:00:14.0-2, ASIX AX88179 USB 3.0 Gigabit Ethernet,
> > 02:5e:c0:4b:a4:f7
> > ax88179_178a 2-2:1.0 eth0: ax88179 - Link status is: 1
> >
> > The dmesg error I get:
> >
>
> Thanks for the report. This driver is probably lying on skb->truesize.
>
> This commit looks suspicious
>
> commit f8ebb3ac881b17712e1d5967c97ab1806b16d3d6
> Author: Jose Alonso <joalonsof@...il.com>
> Date:   Tue Jun 28 12:13:02 2022 -0300
>
>     net: usb: ax88179_178a: Fix packet receiving

Could you try this patch ?

diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c
index 88e084534853dd50505fd730e7ccd07c70f2d8ee..ca33365e49cc3993a974ddbdbf68189ce4df2e82
100644
--- a/drivers/net/usb/ax88179_178a.c
+++ b/drivers/net/usb/ax88179_178a.c
@@ -1452,21 +1452,16 @@ static int ax88179_rx_fixup(struct usbnet
*dev, struct sk_buff *skb)
                        /* Skip IP alignment pseudo header */
                        skb_pull(skb, 2);

-                       skb->truesize = SKB_TRUESIZE(pkt_len_plus_padd);
                        ax88179_rx_checksum(skb, pkt_hdr);
                        return 1;
                }

-               ax_skb = skb_clone(skb, GFP_ATOMIC);
+               ax_skb = netdev_alloc_skb_ip_align(dev->net, pkt_len);
                if (!ax_skb)
                        return 0;
-               skb_trim(ax_skb, pkt_len);
+               skb_put(ax_skb, pkt_len);
+               memcpy(ax_skb->data, skb->data + 2, pkt_len);

-               /* Skip IP alignment pseudo header */
-               skb_pull(ax_skb, 2);
-
-               skb->truesize = pkt_len_plus_padd +
-                               SKB_DATA_ALIGN(sizeof(struct sk_buff));
                ax88179_rx_checksum(ax_skb, pkt_hdr);
                usbnet_skb_return(dev, ax_skb);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ