bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Phi Nguyen <phind.uet@gmail.com>
To: Neal Cardwell <ncardwell@google.com>
Cc: Eric Dumazet <edumazet@google.com>,
	David Miller <davem@davemloft.net>,
	Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>,
	David Ahern <dsahern@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>,
	Martin KaFai Lau <kafai@fb.com>, Song Liu <songliubraving@fb.com>,
	John Fastabend <john.fastabend@gmail.com>,
	kpsingh@kernel.org, netdev <netdev@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>, bpf <bpf@vger.kernel.org>,
	linux-kernel-mentees@lists.linuxfoundation.org,
	syzbot+f1e24a0594d4e3a895d3@syzkaller.appspotmail.com,
	Yuchung Cheng <ycheng@google.com>
Subject: Re: [PATCH] tcp: Do not reset the icsk_ca_initialized in tcp_init_transfer.
Date: Tue, 29 Jun 2021 01:15:01 +0800	[thread overview]
Message-ID: <ee5ef69e-ee3f-1df0-2033-5adc06a46b9c@gmail.com> (raw)
In-Reply-To: <CADVnQy=Q9W=Vxu81ctPLx08D=ALnHBXGr0c4BLtQGxwQE+yjRg@mail.gmail.com>

On 6/29/2021 12:24 AM, Neal Cardwell wrote:

> Thanks.
> 
> Can you also please provide a summary of the event sequence that
> triggers the bug? Based on your Reported-by tag, I guess this is based
> on the syzbot reproducer:
> 
>   https://groups.google.com/g/syzkaller-bugs/c/VbHoSsBz0hk/m/cOxOoTgPCAAJ
> 
> but perhaps you can give a summary of the event sequence that causes
> the bug? Is it that the call:
> 
> setsockopt$inet_tcp_TCP_CONGESTION(r0, 0x6, 0xd,
> &(0x7f0000000000)='cdg\x00', 0x4)
> 
> initializes the CC and happens before the connection is established,
> and then when the connection is established, the line that sets:
>    icsk->icsk_ca_initialized = 0;
> is incorrect, causing the CC to be initialized again without first
> calling the cleanup code that deallocates the CDG-allocated memory?
> 
> thanks,
> neal
> 

Hi Neal,

The gdb stack trace that lead to init_transfer_input() is as bellow, the 
current sock state is TCP_SYN_RECV.

#0  tcp_cdg_init (sk=sk@entry=0xffff8880275fa080) at net/ipv4/tcp_cdg.c:380
#1  0xffffffff83a3c129 in tcp_init_congestion_control 
(sk=sk@entry=0xffff8880275fa080) at net/ipv4/tcp_cong.c:183
#2  0xffffffff83a21312 in tcp_init_transfer 
(sk=sk@entry=0xffff8880275fa080, bpf_op=bpf_op@entry=5, 
skb=skb@entry=0xffff888027704400) at net/ipv4/tcp_input.c:5928
#3  0xffffffff83a22a55 in tcp_rcv_state_process 
(sk=sk@entry=0xffff8880275fa080, skb=skb@entry=0xffff888027704400) at 
net/ipv4/tcp_input.c:6416
#4  0xffffffff83a35f8a in tcp_v4_do_rcv (sk=sk@entry=0xffff8880275fa080, 
skb=skb@entry=0xffff888027704400) at net/ipv4/tcp_ipv4.c:1716
#5  0xffffffff83a39300 in tcp_v4_rcv (skb=0xffff888027704400) at 
net/ipv4/tcp_ipv4.c:2087
#6  0xffffffff839eaf57 in ip_protocol_deliver_rcu 
(net=net@entry=0xffff888022858180, skb=skb@entry=0xffff888027704400, 
protocol=<optimized out>) at net/ipv4/ip_input.c:204
#7  0xffffffff839eb266 in ip_local_deliver_finish 
(net=0xffff888022858180, sk=<optimized out>, skb=0xffff888027704400) at 
./include/linux/skbuff.h:2544
#8  0xffffffff839eb34a in NF_HOOK (sk=0x0 <fixed_percpu_data>, pf=2 
'\002', hook=1, in=<optimized out>, out=0x0 <fixed_percpu_data>, 
okfn=0xffffffff839eb1f0 <ip_local_deliver_finish>,
     skb=0xffff888027704400, net=0xffff888022858180) at 
./include/linux/netfilter.h:307
#9  NF_HOOK (pf=2 '\002', sk=0x0 <fixed_percpu_data>, out=0x0 
<fixed_percpu_data>, okfn=0xffffffff839eb1f0 <ip_local_deliver_finish>, 
in=<optimized out>, skb=0xffff888027704400,
     net=0xffff888022858180, hook=1) at ./include/linux/netfilter.h:301
#10 ip_local_deliver (skb=0xffff888027704400) at net/ipv4/ip_input.c:252
#11 0xffffffff839ea58e in dst_input (skb=0xffff888027704400) at 
./include/linux/skbuff.h:980
#12 ip_rcv_finish (net=net@entry=0xffff888022858180, sk=sk@entry=0x0 
<fixed_percpu_data>, skb=skb@entry=0xffff888027704400) at 
net/ipv4/ip_input.c:429
#13 0xffffffff839eb4fa in NF_HOOK (sk=0x0 <fixed_percpu_data>, pf=2 
'\002', hook=0, in=0xffff888022a20000, out=0x0 <fixed_percpu_data>, 
okfn=0xffffffff839ea4b0 <ip_rcv_finish>, skb=0xffff888027704400,
     net=0xffff888022858180) at ./include/linux/netfilter.h:307
#14 NF_HOOK (pf=2 '\002', sk=0x0 <fixed_percpu_data>, out=0x0 
<fixed_percpu_data>, okfn=0xffffffff839ea4b0 <ip_rcv_finish>, 
in=0xffff888022a20000, skb=0xffff888027704400, net=0xffff888022858180,
     hook=0) at ./include/linux/netfilter.h:301
#15 ip_rcv (skb=0xffff888027704400, dev=0xffff888022a20000, 
pt=<optimized out>, orig_dev=<optimized out>) at net/ipv4/ip_input.c:540
#16 0xffffffff83712acf in __netif_receive_skb_one_core (skb=<optimized 
out>, skb@entry=0xffff888027704400, pfmemalloc=pfmemalloc@entry=false) 
at net/core/dev.c:5482
#17 0xffffffff83712b59 in __netif_receive_skb (skb=0xffff888027704400) 
at net/core/dev.c:5596
#18 0xffffffff83712f09 in process_backlog (napi=0xffff88803ec2c8d0, 
quota=64) at net/core/dev.c:6460
#19 0xffffffff837159f2 in __napi_poll (n=n@entry=0xffff88803ec2c8d0, 
repoll=repoll@entry=0xffffc900007b7e0f) at net/core/dev.c:7015
#20 0xffffffff837161b2 in napi_poll (repoll=0xffffc900007b7e20, 
n=0xffff88803ec2c8d0) at net/core/dev.c:7082
#21 net_rx_action (h=<optimized out>) at net/core/dev.c:7169
#22 0xffffffff84600114 in __do_softirq () at kernel/softirq.c:558
#23 0xffffffff81241506 in run_ksoftirqd (cpu=<optimized out>) at 
kernel/softirq.c:920
#24 run_ksoftirqd (cpu=<optimized out>) at kernel/softirq.c:912
#25 0xffffffff8127ec83 in smpboot_thread_fn (data=0xffff888008f70240) at 
kernel/smpboot.c:164
#26 0xffffffff81274475 in kthread (_create=<optimized out>) at 
kernel/kthread.c:319
#27 0xffffffff8100230f in ret_from_fork () at arch/x86/entry/entry_64.S:295
#28 0x0000000000000000 in ?? ()

Best Regards.

  reply	other threads:[~2021-06-28 17:15 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-28 14:49 [PATCH] tcp: Do not reset the icsk_ca_initialized in tcp_init_transfer Nguyen Dinh Phi
2021-06-28 14:52 ` Eric Dumazet
2021-06-28 16:18   ` Phi Nguyen
2021-06-28 16:24     ` Neal Cardwell
2021-06-28 17:15       ` Phi Nguyen [this message]
2021-06-28 17:20         ` Neal Cardwell
2021-06-28 23:41           ` Martin KaFai Lau
2021-06-29  7:17           ` Nguyen Dinh Phi
2021-06-29  8:21             ` Eric Dumazet
2021-06-29 12:28               ` Nguyen Dinh Phi
2021-06-29 12:58                 ` Eric Dumazet
2021-06-29 15:59                   ` Neal Cardwell
2021-06-30 18:25                     ` Phi Nguyen
2021-07-01 14:23                       ` Neal Cardwell
2021-06-28 17:09 ` Neal Cardwell

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=ee5ef69e-ee3f-1df0-2033-5adc06a46b9c@gmail.com \
    --to=phind.uet@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=kafai@fb.com \
    --cc=kpsingh@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel-mentees@lists.linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ncardwell@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=songliubraving@fb.com \
    --cc=syzbot+f1e24a0594d4e3a895d3@syzkaller.appspotmail.com \
    --cc=ycheng@google.com \
    --cc=yoshfuji@linux-ipv6.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).