linux/arch/um
Johannes Berg 7e60746005 um: virtio: Keep reading on -EAGAIN
When we get an interrupt from the socket getting readable,
and start reading, there's a possibility for a race. This
depends on the implementation of the device, but e.g. with
qemu's libvhost-user, we can see:

 device                 virtio_uml
---------------------------------------
  write header
                         get interrupt
                         read header
                         read body -> returns -EAGAIN
  write body

The -EAGAIN return is because the socket is non-blocking,
and then this leads us to abandon this message.

In fact, we've already read the header, so when the get
another signal/interrupt for the body, we again read it
as though it's a new message header, and also abandon it
for the same reason (wrong size etc.)

This essentially breaks things, and if that message was
one that required a response, it leads to a deadlock as
the device is waiting for the response but we'll never
reply.

Fix this by spinning on -EAGAIN as well when we read the
message body. We need to handle -EAGAIN as "no message"
while reading the header, since we share an interrupt.

Note that this situation is highly unlikely to occur in
normal usage, since there will be very few messages and
only in the startup phase. With the inband call feature
this does tend to happen (eventually) though.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
2019-11-25 22:43:13 +01:00
..
configs um: configs: Remove useless UEVENT_HELPER_PATH 2019-07-02 23:27:41 +02:00
drivers um: virtio: Keep reading on -EAGAIN 2019-11-25 22:43:13 +01:00
include mm: treewide: clarify pgtable_page_{ctor,dtor}() naming 2019-09-26 10:10:44 -07:00
kernel um: irq: Fix LAST_IRQ usage in init_IRQ() 2019-09-16 08:38:58 +02:00
os-Linux um: Don't trace irqflags during shutdown 2019-11-25 22:42:57 +01:00
scripts License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
.gitignore um: tell git to ignore generated files 2010-03-06 11:26:28 -08:00
Kconfig kbuild: add CONFIG_ASM_MODVERSIONS 2019-08-22 01:14:11 +09:00
Kconfig.debug um: Make GCOV depend on !KCOV 2018-12-27 22:48:19 +01:00
Makefile kbuild: remove src and obj from the top Makefile 2019-07-11 00:05:09 +09:00
Makefile-os-Linux x86, um: get rid of arch/um/os symlink 2008-10-22 22:55:22 -07:00
Makefile-skas