* Re: KASAN: use-after-free Read in rds_tcp_tune [not found] <001a1141a524c513ca05628d8ad4@google.com> @ 2018-01-12 18:30 ` Sowmini Varadhan 2018-02-14 15:11 ` Dmitry Vyukov 0 siblings, 1 reply; 11+ messages in thread From: Sowmini Varadhan @ 2018-01-12 18:30 UTC (permalink / raw) To: syzbot Cc: davem, linux-kernel, linux-rdma, netdev, rds-devel, santosh.shilimkar, syzkaller-bugs On (01/11/18 21:29), syzbot wrote: > ================================================================== > BUG: KASAN: use-after-free in rds_tcp_tune+0x491/0x520 net/rds/tcp.c:397 > Read of size 4 at addr ffff8801cd5f6c58 by task kworker/u4:4/4954 Just had an offline discussion with santosh around this, here's a summary of that discussion for the archives: Looks like an rds_connect_worker workq got scheduled after the netns was deleted. This could happen if an an rds_connection got added between lines 528 and 529 of 506 static void rds_tcp_kill_sock(struct net *net) : /* code to pull out all the rds_connections that should be destroyed */ : 528 spin_unlock_irq(&rds_tcp_conn_lock); 529 list_for_each_entry_safe(tc, _tc, &tmp_list, t_tcp_node) 530 rds_conn_destroy(tc->t_cpath->cp_conn); Such an rds_connection would miss out the rds_conn_destroy() loop (that cancels all pending work) and (if it was scheduled after netns deletion) could trigger the use-after-free. Evaluating various fixes for this (including using _bh instead of _irq as suggested by santosh), I'll get back with a patch soon. --Sowmini ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: KASAN: use-after-free Read in rds_tcp_tune 2018-01-12 18:30 ` KASAN: use-after-free Read in rds_tcp_tune Sowmini Varadhan @ 2018-02-14 15:11 ` Dmitry Vyukov 2018-02-14 15:21 ` Sowmini Varadhan 0 siblings, 1 reply; 11+ messages in thread From: Dmitry Vyukov @ 2018-02-14 15:11 UTC (permalink / raw) To: Sowmini Varadhan Cc: syzbot, David Miller, LKML, linux-rdma, netdev, rds-devel, Santosh Shilimkar, syzkaller-bugs On Fri, Jan 12, 2018 at 7:30 PM, Sowmini Varadhan <sowmini.varadhan@oracle.com> wrote: > On (01/11/18 21:29), syzbot wrote: >> ================================================================== >> BUG: KASAN: use-after-free in rds_tcp_tune+0x491/0x520 net/rds/tcp.c:397 >> Read of size 4 at addr ffff8801cd5f6c58 by task kworker/u4:4/4954 > > Just had an offline discussion with santosh around this, here's a summary > of that discussion for the archives: > > Looks like an rds_connect_worker workq got scheduled after the > netns was deleted. This could happen if an an rds_connection got > added between lines 528 and 529 of > > 506 static void rds_tcp_kill_sock(struct net *net) > : > /* code to pull out all the rds_connections that should be destroyed */ > : > 528 spin_unlock_irq(&rds_tcp_conn_lock); > 529 list_for_each_entry_safe(tc, _tc, &tmp_list, t_tcp_node) > 530 rds_conn_destroy(tc->t_cpath->cp_conn); > > Such an rds_connection would miss out the rds_conn_destroy() > loop (that cancels all pending work) and (if it was scheduled > after netns deletion) could trigger the use-after-free. > > Evaluating various fixes for this (including using _bh instead of _irq > as suggested by santosh), I'll get back with a patch soon. Hi Sowmini, Was this ever fixed? What's the fix? This still hangs as open. Please provide "syz fix" tag. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: KASAN: use-after-free Read in rds_tcp_tune 2018-02-14 15:11 ` Dmitry Vyukov @ 2018-02-14 15:21 ` Sowmini Varadhan 2018-02-14 15:28 ` Dmitry Vyukov 0 siblings, 1 reply; 11+ messages in thread From: Sowmini Varadhan @ 2018-02-14 15:21 UTC (permalink / raw) To: Dmitry Vyukov Cc: syzbot, David Miller, LKML, linux-rdma, netdev, rds-devel, Santosh Shilimkar, syzkaller-bugs On (02/14/18 16:11), Dmitry Vyukov wrote: > > Hi Sowmini, > > Was this ever fixed? What's the fix? This still hangs as open. Please > provide "syz fix" tag. Are you still seeing this problem? I had expected that the changes around rds_destroy_pending - see commit ebeeb1ad9b8a - would have taken care of this (note that ebeeb1ad9b8a refactors/updates 3db6e0d172c9) but those fixes were done by inspection only. In other words, I was never able to reproduce this, so we may still have missed some race condition. --Sowmini ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: KASAN: use-after-free Read in rds_tcp_tune 2018-02-14 15:21 ` Sowmini Varadhan @ 2018-02-14 15:28 ` Dmitry Vyukov 2018-02-14 15:35 ` Sowmini Varadhan 0 siblings, 1 reply; 11+ messages in thread From: Dmitry Vyukov @ 2018-02-14 15:28 UTC (permalink / raw) To: Sowmini Varadhan Cc: syzbot, David Miller, LKML, linux-rdma, netdev, rds-devel, Santosh Shilimkar, syzkaller-bugs On Wed, Feb 14, 2018 at 4:21 PM, Sowmini Varadhan <sowmini.varadhan@oracle.com> wrote: > On (02/14/18 16:11), Dmitry Vyukov wrote: >> >> Hi Sowmini, >> >> Was this ever fixed? What's the fix? This still hangs as open. Please >> provide "syz fix" tag. > > Are you still seeing this problem? > > I had expected that the changes around rds_destroy_pending - see commit > ebeeb1ad9b8a - would have taken care of this (note that ebeeb1ad9b8a > refactors/updates 3db6e0d172c9) but those fixes were done by inspection > only. In other words, I was never able to reproduce this, so we may > still have missed some race condition. syzbot is probably not seeing this problem. However if you don't add the Reported-by tag to commit, nor provide syz fix tag, it will consider it as "open". One consequence of this is that it is still on our radars. Another consequence is that syzbot will never report bugs in rds_tcp_tune ever again as it thinks that it's the same known bug, so no point in bothering anybody. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: KASAN: use-after-free Read in rds_tcp_tune 2018-02-14 15:28 ` Dmitry Vyukov @ 2018-02-14 15:35 ` Sowmini Varadhan 2018-02-14 15:55 ` Dmitry Vyukov 2018-02-14 18:49 ` Jason Gunthorpe 0 siblings, 2 replies; 11+ messages in thread From: Sowmini Varadhan @ 2018-02-14 15:35 UTC (permalink / raw) To: Dmitry Vyukov Cc: syzbot, David Miller, LKML, linux-rdma, netdev, rds-devel, Santosh Shilimkar, syzkaller-bugs On (02/14/18 16:28), Dmitry Vyukov wrote: > syzbot is probably not seeing this problem. However if you don't add > the Reported-by tag to commit, nor provide syz fix tag, it will > consider it as "open". One consequence of this is that it is still on > our radars. Another consequence is that syzbot will never report bugs > in rds_tcp_tune ever again as it thinks that it's the same known bug, > so no point in bothering anybody. understood, I think I saw this in the original syzbot mail as well, but I was hesitant to actually add the tag because the fix was based on code-inspection only, and I would have felt more comfortable about asserting the Reported-by if I'd done a clear-cut before/after verification. btw, checkpatch.pl complains about the syzbot*@syzkaller.appspotmail.com addresses as "Unrecognized email address", we should fix that error from checkpatch at some point. --Sowmini ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: KASAN: use-after-free Read in rds_tcp_tune 2018-02-14 15:35 ` Sowmini Varadhan @ 2018-02-14 15:55 ` Dmitry Vyukov 2018-02-14 17:02 ` Joe Perches 2018-02-14 18:49 ` Jason Gunthorpe 1 sibling, 1 reply; 11+ messages in thread From: Dmitry Vyukov @ 2018-02-14 15:55 UTC (permalink / raw) To: Sowmini Varadhan Cc: syzbot, David Miller, LKML, linux-rdma, netdev, rds-devel, Santosh Shilimkar, syzkaller-bugs On Wed, Feb 14, 2018 at 4:35 PM, Sowmini Varadhan <sowmini.varadhan@oracle.com> wrote: > On (02/14/18 16:28), Dmitry Vyukov wrote: >> syzbot is probably not seeing this problem. However if you don't add >> the Reported-by tag to commit, nor provide syz fix tag, it will >> consider it as "open". One consequence of this is that it is still on >> our radars. Another consequence is that syzbot will never report bugs >> in rds_tcp_tune ever again as it thinks that it's the same known bug, >> so no point in bothering anybody. > > understood, I think I saw this in the original syzbot mail as well, > but I was hesitant to actually add the tag because the fix was > based on code-inspection only, and I would have felt more comfortable > about asserting the Reported-by if I'd done a clear-cut before/after > verification. > > btw, checkpatch.pl complains about the syzbot*@syzkaller.appspotmail.com > addresses as "Unrecognized email address", we should fix that > error from checkpatch at some point. Interesting. Looking at checkpatch.pl I think it wants all addresses to be in <>, i.e. Reported-by: <syzbot+bbd8e9a06452cc48059b@syzkaller.appspotmail.com> There probably was some reason to enforce this, so I think I will change the syzbot email template to include <>. Thanks! ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: KASAN: use-after-free Read in rds_tcp_tune 2018-02-14 15:55 ` Dmitry Vyukov @ 2018-02-14 17:02 ` Joe Perches 2018-02-14 17:16 ` Dmitry Vyukov 0 siblings, 1 reply; 11+ messages in thread From: Joe Perches @ 2018-02-14 17:02 UTC (permalink / raw) To: Dmitry Vyukov, Sowmini Varadhan Cc: syzbot, David Miller, LKML, linux-rdma, netdev, rds-devel, Santosh Shilimkar, syzkaller-bugs On Wed, 2018-02-14 at 16:55 +0100, Dmitry Vyukov wrote: > On Wed, Feb 14, 2018 at 4:35 PM, Sowmini Varadhan <sowmini.varadhan@oracle.com> wrote: > > btw, checkpatch.pl complains about the syzbot*@syzkaller.appspotmail.com > > addresses as "Unrecognized email address", we should fix that > > error from checkpatch at some point. > > Interesting. Looking at checkpatch.pl I think it wants all addresses > to be in <>, i.e. > Reported-by: <syzbot+bbd8e9a06452cc48059b@syzkaller.appspotmail.com> > There probably was some reason to enforce this, so I think I will > change the syzbot email template to include <>. > Thanks! Not really. It's the somewhat unusual + in the address that perl needs quoted before a substitution. I believe this fixes it in checkpatch. --- scripts/checkpatch.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 3d4040322ae1..2b8397da39d3 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -1075,7 +1075,7 @@ sub parse_email { } elsif ($formatted_email =~ /(\S+\@\S+)(.*)$/) { $address = $1; $comment = $2 if defined $2; - $formatted_email =~ s/$address.*$//; + $formatted_email =~ s/\Q$address\E.*$//; $name = $formatted_email; $name = trim($name); $name =~ s/^\"|\"$//g; ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: KASAN: use-after-free Read in rds_tcp_tune 2018-02-14 17:02 ` Joe Perches @ 2018-02-14 17:16 ` Dmitry Vyukov 2018-02-14 17:32 ` Joe Perches 0 siblings, 1 reply; 11+ messages in thread From: Dmitry Vyukov @ 2018-02-14 17:16 UTC (permalink / raw) To: Joe Perches Cc: Sowmini Varadhan, syzbot, David Miller, LKML, linux-rdma, netdev, rds-devel, Santosh Shilimkar, syzkaller-bugs On Wed, Feb 14, 2018 at 6:02 PM, Joe Perches <joe@perches.com> wrote: > On Wed, 2018-02-14 at 16:55 +0100, Dmitry Vyukov wrote: >> On Wed, Feb 14, 2018 at 4:35 PM, Sowmini Varadhan <sowmini.varadhan@oracle.com> wrote: >> > btw, checkpatch.pl complains about the syzbot*@syzkaller.appspotmail.com >> > addresses as "Unrecognized email address", we should fix that >> > error from checkpatch at some point. >> >> Interesting. Looking at checkpatch.pl I think it wants all addresses >> to be in <>, i.e. >> Reported-by: <syzbot+bbd8e9a06452cc48059b@syzkaller.appspotmail.com> >> There probably was some reason to enforce this, so I think I will >> change the syzbot email template to include <>. >> Thanks! > > Not really. > > It's the somewhat unusual + in the address > that perl needs quoted before a substitution. > > I believe this fixes it in checkpatch. > --- > scripts/checkpatch.pl | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl > index 3d4040322ae1..2b8397da39d3 100755 > --- a/scripts/checkpatch.pl > +++ b/scripts/checkpatch.pl > @@ -1075,7 +1075,7 @@ sub parse_email { > } elsif ($formatted_email =~ /(\S+\@\S+)(.*)$/) { > $address = $1; > $comment = $2 if defined $2; > - $formatted_email =~ s/$address.*$//; > + $formatted_email =~ s/\Q$address\E.*$//; > $name = $formatted_email; > $name = trim($name); > $name =~ s/^\"|\"$//g; I can confirm that running $ git show HEAD | scripts/checkpatch.pl - on a commit that contains a syzbot Reported-by tag does not produce the warning anymore. Joe, do you mind mailing this as patch? ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: KASAN: use-after-free Read in rds_tcp_tune 2018-02-14 17:16 ` Dmitry Vyukov @ 2018-02-14 17:32 ` Joe Perches 0 siblings, 0 replies; 11+ messages in thread From: Joe Perches @ 2018-02-14 17:32 UTC (permalink / raw) To: Dmitry Vyukov Cc: Sowmini Varadhan, syzbot, David Miller, LKML, linux-rdma, netdev, rds-devel, Santosh Shilimkar, syzkaller-bugs On Wed, 2018-02-14 at 18:16 +0100, Dmitry Vyukov wrote: > On Wed, Feb 14, 2018 at 6:02 PM, Joe Perches <joe@perches.com> wrote: > > On Wed, 2018-02-14 at 16:55 +0100, Dmitry Vyukov wrote: > > > On Wed, Feb 14, 2018 at 4:35 PM, Sowmini Varadhan <sowmini.varadhan@oracle.com> wrote: > > > > btw, checkpatch.pl complains about the syzbot*@syzkaller.appspotmail.com > > > > addresses as "Unrecognized email address", we should fix that > > > > error from checkpatch at some point. > > > > > > Interesting. Looking at checkpatch.pl I think it wants all addresses > > > to be in <>, i.e. > > > Reported-by: <syzbot+bbd8e9a06452cc48059b@syzkaller.appspotmail.com> > > > There probably was some reason to enforce this, so I think I will > > > change the syzbot email template to include <>. > > > Thanks! > > > > Not really. > > > > It's the somewhat unusual + in the address > > that perl needs quoted before a substitution. > > > > I believe this fixes it in checkpatch. > > --- > > scripts/checkpatch.pl | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl [] > > @@ -1075,7 +1075,7 @@ sub parse_email { > > } elsif ($formatted_email =~ /(\S+\@\S+)(.*)$/) { > > $address = $1; > > $comment = $2 if defined $2; > > - $formatted_email =~ s/$address.*$//; > > + $formatted_email =~ s/\Q$address\E.*$//; > > $name = $formatted_email; > > $name = trim($name); > > $name =~ s/^\"|\"$//g; > > > I can confirm that running > $ git show HEAD | scripts/checkpatch.pl - > on a commit that contains a syzbot Reported-by tag does not produce > the warning anymore. > > Joe, do you mind mailing this as patch? 'course not. It's nice you tested it. I did on the last thousand commits without apparent change. $ git log --format=oneline --no-merges -1000 | \ cut -f1 -d" " | \ while read commit ; do \ ./scripts/checkpatch.pl --git $commit --types=bad_sign_off --terse ; \ done ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: KASAN: use-after-free Read in rds_tcp_tune 2018-02-14 15:35 ` Sowmini Varadhan 2018-02-14 15:55 ` Dmitry Vyukov @ 2018-02-14 18:49 ` Jason Gunthorpe 2018-02-14 18:58 ` Dmitry Vyukov 1 sibling, 1 reply; 11+ messages in thread From: Jason Gunthorpe @ 2018-02-14 18:49 UTC (permalink / raw) To: Sowmini Varadhan Cc: Dmitry Vyukov, syzbot, David Miller, LKML, linux-rdma, netdev, rds-devel, Santosh Shilimkar, syzkaller-bugs On Wed, Feb 14, 2018 at 10:35:55AM -0500, Sowmini Varadhan wrote: > On (02/14/18 16:28), Dmitry Vyukov wrote: > > syzbot is probably not seeing this problem. However if you don't add > > the Reported-by tag to commit, nor provide syz fix tag, it will > > consider it as "open". One consequence of this is that it is still on > > our radars. Another consequence is that syzbot will never report bugs > > in rds_tcp_tune ever again as it thinks that it's the same known bug, > > so no point in bothering anybody. > > understood, I think I saw this in the original syzbot mail as well, > but I was hesitant to actually add the tag because the fix was > based on code-inspection only, and I would have felt more comfortable > about asserting the Reported-by if I'd done a clear-cut before/after > verification. I think the point is you have to clear it from syzbot to get it to even test your patches, even if you are not totally sure your patch fixes it? Jason ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: KASAN: use-after-free Read in rds_tcp_tune 2018-02-14 18:49 ` Jason Gunthorpe @ 2018-02-14 18:58 ` Dmitry Vyukov 0 siblings, 0 replies; 11+ messages in thread From: Dmitry Vyukov @ 2018-02-14 18:58 UTC (permalink / raw) To: Jason Gunthorpe Cc: Sowmini Varadhan, syzbot, David Miller, LKML, linux-rdma, netdev, rds-devel, Santosh Shilimkar, syzkaller-bugs On Wed, Feb 14, 2018 at 7:49 PM, Jason Gunthorpe <jgg@ziepe.ca> wrote: > On Wed, Feb 14, 2018 at 10:35:55AM -0500, Sowmini Varadhan wrote: >> On (02/14/18 16:28), Dmitry Vyukov wrote: >> > syzbot is probably not seeing this problem. However if you don't add >> > the Reported-by tag to commit, nor provide syz fix tag, it will >> > consider it as "open". One consequence of this is that it is still on >> > our radars. Another consequence is that syzbot will never report bugs >> > in rds_tcp_tune ever again as it thinks that it's the same known bug, >> > so no point in bothering anybody. >> >> understood, I think I saw this in the original syzbot mail as well, >> but I was hesitant to actually add the tag because the fix was >> based on code-inspection only, and I would have felt more comfortable >> about asserting the Reported-by if I'd done a clear-cut before/after >> verification. > > I think the point is you have to clear it from syzbot to get it to > even test your patches, even if you are not totally sure your patch > fixes it? Sorry, I failed to parse this sentence. Can you please rephrase it? ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2018-02-14 18:59 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <001a1141a524c513ca05628d8ad4@google.com>
2018-01-12 18:30 ` KASAN: use-after-free Read in rds_tcp_tune Sowmini Varadhan
2018-02-14 15:11 ` Dmitry Vyukov
2018-02-14 15:21 ` Sowmini Varadhan
2018-02-14 15:28 ` Dmitry Vyukov
2018-02-14 15:35 ` Sowmini Varadhan
2018-02-14 15:55 ` Dmitry Vyukov
2018-02-14 17:02 ` Joe Perches
2018-02-14 17:16 ` Dmitry Vyukov
2018-02-14 17:32 ` Joe Perches
2018-02-14 18:49 ` Jason Gunthorpe
2018-02-14 18:58 ` Dmitry Vyukov
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox