On Wed, 2017-06-14 at 09:17 +0100, Daniel P. Berrange wrote: > 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.om...@oracle.com> > > Reviewed-by: Bhavesh Davda <bhavesh.da...@oracle.com> > > Reviewed-by: Yuval Shaia <yuval.sh...@oracle.com> > > Reviewed-by: Girish Moodalbail <girish.moodalb...@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
Ok, v3 will be from this base, Knut > > Regards, > Daniel