qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Daniel P. Berrange" <berrange@redhat.com>
To: Knut Omang <knut.omang@oracle.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 2/2] socket: Handle race condition between binds to the same port
Date: Wed, 14 Jun 2017 09:17:17 +0100	[thread overview]
Message-ID: <20170614081717.GA4370@redhat.com> (raw)
In-Reply-To: <c1871854a5510bdb24198d266c28788aa81d3f10.1497035841.git-series.knut.omang@oracle.com>

On Fri, Jun 09, 2017 at 09:19:49PM +0200, Knut Omang wrote:
> If an offset of ports is specified to the inet_listen_saddr function(),
> and two or more processes tries to bind from these ports at the same time,
> occasionally more than one process may be able to bind to the same
> port. The condition is detected by listen() but too late to avoid a failure.
> 
> This function is called by socket_listen() and used
> by all socket listening code in QEMU, so all cases where any form of dynamic
> port selection is used should be subject to this issue.
> 
> Add code to close and re-establish the socket when this
> condition is observed, hiding the race condition from the user.
> 
> This has been developed and tested by means of the
> test-listen unit test in the previous commit.
> Enable the test for make check now that it passes.
> 
> Signed-off-by: Knut Omang <knut.omang@oracle.com>
> Reviewed-by: Bhavesh Davda <bhavesh.davda@oracle.com>
> Reviewed-by: Yuval Shaia <yuval.shaia@oracle.com>
> Reviewed-by: Girish Moodalbail <girish.moodalbail@oracle.com>
> ---
>  tests/Makefile.include |   2 +-
>  util/qemu-sockets.c    | 106 +++++++++++++++++++++++++++++-------------
>  2 files changed, 76 insertions(+), 32 deletions(-)

FYI, the changes here will conflict with a pull request that I have
pending, so please rebase against this PR

https://lists.gnu.org/archive/html/qemu-devel/2017-06/msg01940.html

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

  reply	other threads:[~2017-06-14  8:17 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-09 19:19 [Qemu-devel] [PATCH 0/2] Unit test+fix for problem with QEMU handling of multiple bind()s to the same port Knut Omang
2017-06-09 19:19 ` [Qemu-devel] [PATCH 1/2] Add test-listen - a stress test for QEMU socket listen Knut Omang
2017-06-09 19:19 ` [Qemu-devel] [PATCH 2/2] socket: Handle race condition between binds to the same port Knut Omang
2017-06-14  8:17   ` Daniel P. Berrange [this message]
2017-06-14 11:34     ` Knut Omang
2017-06-09 19:25 ` [Qemu-devel] [PATCH 0/2] Unit test+fix for problem with QEMU handling of multiple bind()s " no-reply
2017-06-09 19:39 ` Eric Blake
2017-06-13  5:36   ` Knut Omang
2017-06-09 21:04 ` no-reply
2017-06-13  6:42   ` Knut Omang
2017-06-13  7:21     ` Fam Zheng
2017-06-09 21:16 ` no-reply

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=20170614081717.GA4370@redhat.com \
    --to=berrange@redhat.com \
    --cc=knut.omang@oracle.com \
    --cc=kraxel@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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).