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]
Message-ID: <14d6af16-c93d-4b38-b748-76c894c0cdf2@redhat.com>
Date: Tue, 20 May 2025 11:34:26 +0200
From: Paolo Abeni <pabeni@...hat.com>
To: chia-yu.chang@...ia-bell-labs.com, linux-doc@...r.kernel.org,
 corbet@....net, horms@...nel.org, dsahern@...nel.org, kuniyu@...zon.com,
 bpf@...r.kernel.org, netdev@...r.kernel.org, dave.taht@...il.com,
 jhs@...atatu.com, kuba@...nel.org, stephen@...workplumber.org,
 xiyou.wangcong@...il.com, jiri@...nulli.us, davem@...emloft.net,
 edumazet@...gle.com, andrew+netdev@...n.ch, donald.hunter@...il.com,
 ast@...erby.net, liuhangbin@...il.com, shuah@...nel.org,
 linux-kselftest@...r.kernel.org, ij@...nel.org, ncardwell@...gle.com,
 koen.de_schepper@...ia-bell-labs.com, g.white@...lelabs.com,
 ingemar.s.johansson@...csson.com, mirja.kuehlewind@...csson.com,
 cheshire@...le.com, rs.ietf@....at, Jason_Livingood@...cast.com,
 vidhi_goel@...le.com
Subject: Re: [PATCH v7 net-next 08/15] tcp: sack option handling improvements

On 5/14/25 3:56 PM, chia-yu.chang@...ia-bell-labs.com wrote:
> From: Ilpo Järvinen <ij@...nel.org>
> 
> 1) Don't early return when sack doesn't fit. AccECN code will be
>    placed after this fragment so no early returns please.
> 
> 2) Make sure opts->num_sack_blocks is not left undefined. E.g.,
>    tcp_current_mss() does not memset its opts struct to zero.
>    AccECN code checks if SACK option is present and may even
>    alter it to make room for AccECN option when many SACK blocks
>    are present. Thus, num_sack_blocks needs to be always valid.
> 
> Signed-off-by: Ilpo Järvinen <ij@...nel.org>
> Signed-off-by: Chia-Yu Chang <chia-yu.chang@...ia-bell-labs.com>
> ---
>  net/ipv4/tcp_output.c | 23 ++++++++++++-----------
>  1 file changed, 12 insertions(+), 11 deletions(-)
> 
> diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
> index d0f0fee8335e..d7fef3d2698b 100644
> --- a/net/ipv4/tcp_output.c
> +++ b/net/ipv4/tcp_output.c
> @@ -1092,17 +1092,18 @@ static unsigned int tcp_established_options(struct sock *sk, struct sk_buff *skb
>  	eff_sacks = tp->rx_opt.num_sacks + tp->rx_opt.dsack;
>  	if (unlikely(eff_sacks)) {
>  		const unsigned int remaining = MAX_TCP_OPTION_SPACE - size;
> -		if (unlikely(remaining < TCPOLEN_SACK_BASE_ALIGNED +
> -					 TCPOLEN_SACK_PERBLOCK))
> -			return size;
> -
> -		opts->num_sack_blocks =
> -			min_t(unsigned int, eff_sacks,
> -			      (remaining - TCPOLEN_SACK_BASE_ALIGNED) /
> -			      TCPOLEN_SACK_PERBLOCK);
> -
> -		size += TCPOLEN_SACK_BASE_ALIGNED +
> -			opts->num_sack_blocks * TCPOLEN_SACK_PERBLOCK;
> +		if (likely(remaining >= TCPOLEN_SACK_BASE_ALIGNED +
> +					TCPOLEN_SACK_PERBLOCK)) {
> +			opts->num_sack_blocks =
> +				min_t(unsigned int, eff_sacks,
> +				      (remaining - TCPOLEN_SACK_BASE_ALIGNED) /
> +				      TCPOLEN_SACK_PERBLOCK);
> +
> +			size += TCPOLEN_SACK_BASE_ALIGNED +
> +				opts->num_sack_blocks * TCPOLEN_SACK_PERBLOCK;
> +		}
> +	} else {
> +		opts->num_sack_blocks = 0;
>  	}

AFAICS here opts->num_sack_blocks is still uninitialized when:

    eff_acks != 0 &&
    remaining < (TCPOLEN_SACK_BASE_ALIGNED + TCPOLEN_SACK_PERBLOCK)

/P


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ