* [Qemu-devel] [PATCH 1/1] rng random backend: check for -EAGAIN errors on read
@ 2013-04-16 10:28 Amit Shah
2013-04-16 13:51 ` Andreas Färber
2013-04-22 18:36 ` Anthony Liguori
0 siblings, 2 replies; 4+ messages in thread
From: Amit Shah @ 2013-04-16 10:28 UTC (permalink / raw)
To: Anthony Liguori; +Cc: Amit Shah, qemu list
Not handling EAGAIN triggers the assert
qemu/backends/rng-random.c:44:entropy_available: assertion failed: (len != -1)
Aborted (core dumped)
This happens when starting a guest with '-device virtio-rng-pci',
issuing a 'cat /dev/hwrng' in the guest, while also doing 'cat
/dev/random' on the host.
Reported-by: yunpingzheng <yunzheng@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
---
backends/rng-random.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/backends/rng-random.c b/backends/rng-random.c
index d5761f2..830360c 100644
--- a/backends/rng-random.c
+++ b/backends/rng-random.c
@@ -41,6 +41,9 @@ static void entropy_available(void *opaque)
ssize_t len;
len = read(s->fd, buffer, s->size);
+ if (len < 0 && errno == EAGAIN) {
+ return;
+ }
g_assert(len != -1);
s->receive_func(s->opaque, buffer, len);
--
1.8.1.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH 1/1] rng random backend: check for -EAGAIN errors on read
2013-04-16 10:28 [Qemu-devel] [PATCH 1/1] rng random backend: check for -EAGAIN errors on read Amit Shah
@ 2013-04-16 13:51 ` Andreas Färber
2013-04-16 15:08 ` Amit Shah
2013-04-22 18:36 ` Anthony Liguori
1 sibling, 1 reply; 4+ messages in thread
From: Andreas Färber @ 2013-04-16 13:51 UTC (permalink / raw)
To: Amit Shah; +Cc: qemu list, Anthony Liguori, qemu-stable
Am 16.04.2013 12:28, schrieb Amit Shah:
> Not handling EAGAIN triggers the assert
>
> qemu/backends/rng-random.c:44:entropy_available: assertion failed: (len != -1)
> Aborted (core dumped)
>
> This happens when starting a guest with '-device virtio-rng-pci',
> issuing a 'cat /dev/hwrng' in the guest, while also doing 'cat
> /dev/random' on the host.
>
> Reported-by: yunpingzheng <yunzheng@redhat.com>
> Signed-off-by: Amit Shah <amit.shah@redhat.com>
Doesn't this apply to stable, too, then?
Regards,
Andreas
> ---
> backends/rng-random.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/backends/rng-random.c b/backends/rng-random.c
> index d5761f2..830360c 100644
> --- a/backends/rng-random.c
> +++ b/backends/rng-random.c
> @@ -41,6 +41,9 @@ static void entropy_available(void *opaque)
> ssize_t len;
>
> len = read(s->fd, buffer, s->size);
> + if (len < 0 && errno == EAGAIN) {
> + return;
> + }
> g_assert(len != -1);
>
> s->receive_func(s->opaque, buffer, len);
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH 1/1] rng random backend: check for -EAGAIN errors on read
2013-04-16 13:51 ` Andreas Färber
@ 2013-04-16 15:08 ` Amit Shah
0 siblings, 0 replies; 4+ messages in thread
From: Amit Shah @ 2013-04-16 15:08 UTC (permalink / raw)
To: Andreas Färber; +Cc: qemu list, Anthony Liguori, qemu-stable
On (Tue) 16 Apr 2013 [15:51:30], Andreas Färber wrote:
> Am 16.04.2013 12:28, schrieb Amit Shah:
> > Not handling EAGAIN triggers the assert
> >
> > qemu/backends/rng-random.c:44:entropy_available: assertion failed: (len != -1)
> > Aborted (core dumped)
> >
> > This happens when starting a guest with '-device virtio-rng-pci',
> > issuing a 'cat /dev/hwrng' in the guest, while also doing 'cat
> > /dev/random' on the host.
> >
> > Reported-by: yunpingzheng <yunzheng@redhat.com>
> > Signed-off-by: Amit Shah <amit.shah@redhat.com>
>
> Doesn't this apply to stable, too, then?
Ah, good point, it does.
Thanks for CC'ing stable.
Amit
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH 1/1] rng random backend: check for -EAGAIN errors on read
2013-04-16 10:28 [Qemu-devel] [PATCH 1/1] rng random backend: check for -EAGAIN errors on read Amit Shah
2013-04-16 13:51 ` Andreas Färber
@ 2013-04-22 18:36 ` Anthony Liguori
1 sibling, 0 replies; 4+ messages in thread
From: Anthony Liguori @ 2013-04-22 18:36 UTC (permalink / raw)
To: Amit Shah, Anthony Liguori; +Cc: qemu list, qemu-stable
Applied. Thanks.
Regards,
Anthony Liguori
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-04-22 18:36 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-16 10:28 [Qemu-devel] [PATCH 1/1] rng random backend: check for -EAGAIN errors on read Amit Shah
2013-04-16 13:51 ` Andreas Färber
2013-04-16 15:08 ` Amit Shah
2013-04-22 18:36 ` Anthony Liguori
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).