[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZFI102tIiZFiZNK4@gondor.apana.org.au>
Date: Wed, 3 May 2023 18:22:11 +0800
From: Herbert Xu <herbert@...dor.apana.org.au>
To: Dmitry Vyukov <dvyukov@...gle.com>
Cc: syzbot <syzbot+726dc8c62c3536431ceb@...kaller.appspotmail.com>,
davem@...emloft.net, linux-crypto@...r.kernel.org,
linux-kernel@...r.kernel.org, olivia@...enic.com,
syzkaller-bugs@...glegroups.com, Jason Wang <jasowang@...hat.com>,
"Michael S. Tsirkin" <mst@...hat.com>,
Laurent Vivier <lvivier@...hat.com>
Subject: Re: [syzbot] [crypto?] KCSAN: data-race in random_recv_done /
virtio_read (3)
On Fri, Apr 21, 2023 at 04:52:13PM +0200, Dmitry Vyukov wrote:
>
> Here this:
>
> size = min_t(unsigned int, size, vi->data_avail);
> memcpy(buf, vi->data + vi->data_idx, size);
> vi->data_idx += size;
> vi->data_avail -= size;
>
> runs concurrently with:
>
> if (!virtqueue_get_buf(vi->vq, &vi->data_avail))
> return;
> vi->data_idx = 0;
>
> I did not fully grasp how/where vi->data is populated, but it looks
> like it can lead to use of uninit/stale random data, or even to out of
> bounds access, say if vi->data_avail is already updated, but
> vi->data_idx is not yet reset to 0. Then concurrent reading will read
> not where it's supposed to read.
This appears to be a genuine bug. I'll look into it.
Thanks!
--
Email: Herbert Xu <herbert@...dor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Powered by blists - more mailing lists