netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Dmitry Vyukov <dvyukov@google.com>
Cc: dhowells@redhat.com,
	syzbot <syzbot+ebc945fdb4acd72cba78@syzkaller.appspotmail.com>,
	davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	linux-afs@lists.infradead.org, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org, marc.dionne@auristor.com,
	netdev@vger.kernel.org, pabeni@redhat.com,
	syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [afs?] [net?] KCSAN: data-race in rxrpc_send_data / rxrpc_set_call_completion
Date: Mon, 24 Apr 2023 17:05:58 +0100	[thread overview]
Message-ID: <457894.1682352358@warthog.procyon.org.uk> (raw)
In-Reply-To: <CACT4Y+YajDb5QpSziTazoyn587JXwXet2w7Jkqkj9v31HZtJxw@mail.gmail.com>

Dmitry Vyukov <dvyukov@google.com> wrote:

> If I am reading this correctly, rxrpc_send_data() can read wrong
> call->completion and state and incorrectly exit with an error if
> rxrpc_wait_to_be_connected() exists early right after observing error
> set here:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/net/rxrpc/sendmsg.c?id=148341f0a2f53b5e8808d093333d85170586a15d#n58
> The code seems to assume that at that point all writes done by
> rxrpc_set_call_completion() are already finished, but it's not
> necessarily the case.

I'm not sure it matters.  call->error can only be set by the I/O thread and
only if a call fails - in which case the call state will be set shortly
thereafter - plus a couple of places where we fail to set the call up, in
which case we're under the call's user_mutex or didn't even manage to fully
allocate it.

That said, I probably should check the call state first.  I might also want to
ignore any signal if the call did manage to get connected, lest I leave it
dangling - a problem might come if userspace issues a single sendmsg() to set
up the call and supply data to be transmitted.  I need to have a ponder on
that one.

David


      reply	other threads:[~2023-04-24 16:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-24  8:17 [syzbot] [afs?] [net?] KCSAN: data-race in rxrpc_send_data / rxrpc_set_call_completion syzbot
2023-04-24  8:30 ` Dmitry Vyukov
2023-04-24 16:05   ` David Howells [this message]

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=457894.1682352358@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=davem@davemloft.net \
    --cc=dvyukov@google.com \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-afs@lists.infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marc.dionne@auristor.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=syzbot+ebc945fdb4acd72cba78@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.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 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).