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] [day] [month] [year] [list]
Date:   Tue, 25 Jan 2022 16:27:16 -0800
From:   Eric Dumazet <edumazet@...gle.com>
To:     David Ahern <dsahern@...il.com>
Cc:     netdev <netdev@...r.kernel.org>
Subject: Re: [PATCH net-next] net: Adjust sk_gso_max_size once when set

On Tue, Jan 25, 2022 at 3:49 PM David Ahern <dsahern@...il.com> wrote:
>
> On 1/25/22 10:20 AM, Eric Dumazet wrote:
> >> The git history does not explain why MAX_TCP_HEADER is used to lower
> >> sk_gso_max_size. Do you recall the history on it?
> >
> > Simply that max IP datagram size is 64K
> >
> > And TCP is sizing its payload size there (eg in  tcp_tso_autosize()),
> > when skb only contains payload.
> >
> > Headers are added later in various xmit layers.
> >
> > MAX_TCP_HEADER is chosen to avoid re-allocs of skb->head in typical workload.
>
> From what I can tell skb->head is allocated based on MAX_TCP_HEADER, and
> payload is added as frags for TSO.

Sure, but at the end, ip packet length field is 16bit wide, so
sizeof(network+tcp headers) + tcp_payload <= 65535

-> tcp_payload =< 65535 - sizeof(headers)

-> tcp_payload_max_per_skb = 65536 - ( MAX_TCP_HEADER + 1)

(This would not include Ethernet header)

>
> I was just curious because I noticed a few MTUs (I only looked multiples
> of 100 from 1500 to 9000) can get an extra segment in a TSO packet and
> stay under the 64kB limit if that offset had better information of the
> actual header size needed (if any beyond network + tcp).

TCP does not care about the extra sub-mss bytes that _could_ be added
to a TSO packet

So if I have 4K MTU (4096 bytes of payload), max TSO size would be 15*4k = 60K

Application writing 60*1024+100 bytes in one sendmsg() would send one
TSO packet of 15 segments, plus one extra tiny skb with 100 bytes of
payload.

I have played in the past trying to cover this case, but adding tests
in the fast path gave no noticeable difference for common workloads.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ