All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thaison Phan <thaisonphan@google.com>
To: edumazet@kernel.org
Cc: chia-yu.chang@nokia-bell-labs.com, davem@davemloft.net,
	horms@kernel.org,  ij@kernel.org, kuba@kernel.org,
	kuniyu@google.com,  linux-kernel@vger.kernel.org,
	ncardwell@google.com, netdev@vger.kernel.org,
	 olivier.tilmans@nokia.com, pabeni@redhat.com, stani@google.com,
	 thaisonphan@google.com
Subject: Re: [PATCH net 1/2] tcp: initialize ir_rmt_addr and ir_loc_addr in cookie_v6_check()
Date: Mon, 16 Nov 2026 02:30:29 +0000	[thread overview]
Message-ID: <20261116023029.128997-1-thaisonphan@google.com> (raw)
In-Reply-To: <CAL4Wiioi-t+gKL3dLDWcTrd57tv9TEoXUxh8gHjCQSDyT7Xxyw@mail.gmail.com>

On Sun, Nov 15, 2026 at 09:06:59AM +0100, Eric Dumazet wrote:
> Nice catch, but KASAN does not report uninitialized reads.
> Was this KMSAN, or did you notice garbage in the inet_sock_set_state
> tracepoint output?
> 
> Please say which in the changelog, and include the report or the
> trace line if you have one.

I should have explained KASAN's relation to the bug better. It was not caught
by a KASAN/KMSAN report itself, but originally noticed via an out-of-tree
socket hook observing inet_sk(sk)->inet_saddr != LOOPBACK4_IPV6 on KASAN test
runs, and reproduced upstream via the inet_sock_set_state tracepoint.

When KASAN is enabled, SLUB_RCU_DEBUG is enabled by default, introducing an RCU
grace period before freeing the request_sock from the initial SYN. Without that
grace period, cookie_v6_check() typically reuses the warm request_sock whose
ir_rmt_addr and ir_loc_addr were already set to LOOPBACK4_IPV6. With the grace
period, cookie_v6_check() gets a cold slab object instead, e.g. (with
slub_debug=P, expecting 127.0.0.6):

  ... sock:inet_sock_set_state: family=AF_INET6 protocol=IPPROTO_TCP \
      sport=59839 dport=41050 \
      saddr=90.90.90.90 daddr=90.90.90.90 \
      saddrv6=::1 daddrv6=::1 \
      oldstate=TCP_LISTEN newstate=TCP_SYN_RECV

I'll clarify this and include the trace output in the v2 changelog.

  reply	other threads:[~2026-11-16  2:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-14 16:12 [PATCH net 0/2] tcp: initialize missing request_sock fields in syncookie path Thaison Phan
2026-11-14 16:12 ` [PATCH net 1/2] tcp: initialize ir_rmt_addr and ir_loc_addr in cookie_v6_check() Thaison Phan
2026-11-15  8:06   ` Eric Dumazet
2026-11-16  2:30     ` Thaison Phan [this message]
2026-11-14 16:12 ` [PATCH net 2/2] tcp: accecn: initialize AccECN fields in syncookie path Thaison Phan
2026-11-15  8:13   ` Eric Dumazet
2026-11-16  2:32     ` Thaison Phan
2026-11-16 14:16   ` Chia-Yu Chang (Nokia)
2026-11-16 21:58     ` Thaison Phan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261116023029.128997-1-thaisonphan@google.com \
    --to=thaisonphan@google.com \
    --cc=chia-yu.chang@nokia-bell-labs.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=ij@kernel.org \
    --cc=kuba@kernel.org \
    --cc=kuniyu@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ncardwell@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=olivier.tilmans@nokia.com \
    --cc=pabeni@redhat.com \
    --cc=stani@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.