[Qemu-devel] [PATCH v2 0/3] char-socket: Fix race condition

Alberto Garcia posted 3 patches 6 years, 8 months ago
Test docker-mingw@fedora passed
Test asan passed
Test docker-clang@ubuntu failed
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/cover.1550836631.git.berto@igalia.com
Maintainers: "Marc-André Lureau" <marcandre.lureau@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, "Daniel P. Berrangé" <berrange@redhat.com>
There is a newer version of this series
chardev/char-socket.c    | 19 +++++++++++++++++--
include/qemu/main-loop.h | 12 ++++++++++++
io/task.c                |  9 +++------
util/main-loop.c         |  9 +++++++++
4 files changed, 41 insertions(+), 8 deletions(-)
[Qemu-devel] [PATCH v2 0/3] char-socket: Fix race condition
Posted by Alberto Garcia 6 years, 8 months ago
This fixes a race condition in which the tcp_chr_read() ioc handler
can close a connection that is being written to from another thread.

This is essentially v1 rebased on top of the current master, after
Daniel and Marc-André's chardev series have been merged.

Note: vhost-user-test still fails if QTEST_VHOST_USER_FIXME is set.

Berto

RFC: https://lists.gnu.org/archive/html/qemu-devel/2019-02/msg01510.html

v1: https://lists.gnu.org/archive/html/qemu-devel/2019-02/msg01834.html
- Fixes memory leaks and adds a qemu_idle_add() function

v2:
- Rebased on top of the current master (fc3dbb90f2eb069801bfb4cfe9cbc)
- Patches 1 and 2: Remove the changes in char-pty.c, they're not
                   needed after the rebase.
- Patch 3: Fix conflicts after the rebase.

git backport-diff against v1:

Key:
[----] : patches are identical
[####] : number of functional differences between upstream/downstream patch
[down] : patch is downstream-only
The flags [FC] indicate (F)unctional and (C)ontextual differences, respectively

001/3:[down] 'main-loop: Fix GSource leak in qio_task_thread_worker()'
002/3:[0027] [FC] 'main-loop: Add qemu_idle_add()'
003/3:[0004] [FC] 'char-socket: Lock tcp_chr_disconnect() and socket_reconnect_timeout()'

Alberto Garcia (3):
  main-loop: Fix GSource leak in qio_task_thread_worker()
  main-loop: Add qemu_idle_add()
  char-socket: Lock tcp_chr_disconnect() and socket_reconnect_timeout()

 chardev/char-socket.c    | 19 +++++++++++++++++--
 include/qemu/main-loop.h | 12 ++++++++++++
 io/task.c                |  9 +++------
 util/main-loop.c         |  9 +++++++++
 4 files changed, 41 insertions(+), 8 deletions(-)

-- 
2.11.0


Re: [Qemu-devel] [PATCH v2 0/3] char-socket: Fix race condition
Posted by Paolo Bonzini 6 years, 8 months ago
On 22/02/19 12:59, Alberto Garcia wrote:
> This fixes a race condition in which the tcp_chr_read() ioc handler
> can close a connection that is being written to from another thread.
> 
> This is essentially v1 rebased on top of the current master, after
> Daniel and Marc-André's chardev series have been merged.
> 
> Note: vhost-user-test still fails if QTEST_VHOST_USER_FIXME is set.

Thanks.  I'll look into it next (this week most of the time I had set
aside was eaten debugging other chardev issues... it's a rathole :)).

Paolo