[Qemu-devel] [PULL v1 0/5] Merge sockets 2017/06/07

Daniel P. Berrange posted 5 patches 8 years, 5 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20170607175419.13558-1-berrange@redhat.com
Test FreeBSD passed
Test checkpatch passed
Test docker passed
Test s390x passed
io/dns-resolver.c          |   6 +-
tests/.gitignore           |   1 +
tests/Makefile.include     |   4 +
tests/test-sockets-proto.c | 857 +++++++++++++++++++++++++++++++++++++++++++++
util/qemu-sockets.c        |  71 +++-
5 files changed, 918 insertions(+), 21 deletions(-)
create mode 100644 tests/test-sockets-proto.c
[Qemu-devel] [PULL v1 0/5] Merge sockets 2017/06/07
Posted by Daniel P. Berrange 8 years, 5 months ago
The following changes since commit 0db1851becbefe3e50cfc03776fb1f75817376af:

  Merge remote-tracking branch 'remotes/vivier/tags/m68k-for-2.10-pull-request' into staging (2017-06-07 11:56:00 +0100)

are available in the git repository at:

  git://github.com/berrange/qemu tags/pull-sockets-2017-06-07-1

for you to fetch changes up to 8dd2c27927b93aa352c43e8f0b9437f85d2f5f55:

  tests: add functional test validating ipv4/ipv6 address flag handling (2017-06-07 17:15:08 +0100)

----------------------------------------------------------------
Merge sockets 2017/06/07 v1

----------------------------------------------------------------

Daniel P. Berrange (5):
  sockets: ensure we can bind to both ipv4 & ipv6 separately
  sockets: don't block IPv4 clients when listening on "::"
  sockets: ensure we don't accept IPv4 clients when IPv4 is disabled
  io: preserve ipv4/ipv6 flags when resolving InetSocketAddress
  tests: add functional test validating ipv4/ipv6 address flag handling

 io/dns-resolver.c          |   6 +-
 tests/.gitignore           |   1 +
 tests/Makefile.include     |   4 +
 tests/test-sockets-proto.c | 857 +++++++++++++++++++++++++++++++++++++++++++++
 util/qemu-sockets.c        |  71 +++-
 5 files changed, 918 insertions(+), 21 deletions(-)
 create mode 100644 tests/test-sockets-proto.c

-- 
2.9.3


Re: [Qemu-devel] [PULL v1 0/5] Merge sockets 2017/06/07
Posted by Peter Maydell 8 years, 4 months ago
On 7 June 2017 at 18:54, Daniel P. Berrange <berrange@redhat.com> wrote:
> The following changes since commit 0db1851becbefe3e50cfc03776fb1f75817376af:
>
>   Merge remote-tracking branch 'remotes/vivier/tags/m68k-for-2.10-pull-request' into staging (2017-06-07 11:56:00 +0100)
>
> are available in the git repository at:
>
>   git://github.com/berrange/qemu tags/pull-sockets-2017-06-07-1
>
> for you to fetch changes up to 8dd2c27927b93aa352c43e8f0b9437f85d2f5f55:
>
>   tests: add functional test validating ipv4/ipv6 address flag handling (2017-06-07 17:15:08 +0100)
>
> ----------------------------------------------------------------
> Merge sockets 2017/06/07 v1
>
> ----------------------------------------------------------------

Hi; I'm afraid this ran into 'make check' problems:

On OSX and FreeBSD:
  GTESTER check-qtest-i386
ERROR:/Users/pm215/src/qemu-for-merges/tests/test-sockets-proto.c:825:void
test_listen(const void *): assertion failed: (data->ipv6 != 0)
GTester: last random seed: R02Sc21fa7784ab13d0fd3274d86c5a52367
**
ERROR:/Users/pm215/src/qemu-for-merges/tests/test-sockets-proto.c:825:void
test_listen(const void *): assertion failed: (data->ipv6 != 0)
GTester: last random seed: R02Sdf653a63e8d9a5d03bfadb49122f3e9a



On the clang runtime undefined-behavior sanitizer:
  GTESTER check-qtest-i386
/home/petmay01/linaro/qemu-for-merges/qapi/qapi-visit-core.c:139:12:
runtime error: load of value 254, which is not a valid value for type
'bool'

(ditto for check-qtest-ppc64, x86_64
  GTESTER check-qtest-ppc64
/home/petmay01/linaro/qemu-for-merges/qapi/qapi-visit-core.c:139:12:
runtime error: load of value 254, which is not a valid value for type
'bool'

More specifically:
$ UBSAN_OPTIONS=print_stacktrace=1
QTEST_QEMU_BINARY=i386-softmmu/qemu-system-i386 gtester -k --verbose
-m=quick tests/test-sockets-proto -p=/sockets/migrate/wildcard/all
TEST: tests/test-sockets-proto... (pid=1710)
  /sockets/migrate/wildcard/all:
/home/petmay01/linaro/qemu-for-merges/qapi/qapi-visit-core.c:139:12:
runtime error: load of value 224, which is not a valid value for type
'bool'
    #0 0x56308e8ba318 in visit_optional
/home/petmay01/linaro/qemu-for-merges/qapi/qapi-visit-core.c:139:12
    #1 0x56308e892598 in visit_type_InetSocketAddress_members
/home/petmay01/linaro/qemu-for-merges/build/clang/qapi-visit.c:7030:9
    #2 0x56308e8a8ab3 in visit_type_SocketAddress_members
/home/petmay01/linaro/qemu-for-merges/build/clang/qapi-visit.c:12820:9
    #3 0x56308e8829b6 in visit_type_SocketAddress
/home/petmay01/linaro/qemu-for-merges/build/clang/qapi-visit.c:12850:5
    #4 0x56308e873f63 in qapi_free_SocketAddress
/home/petmay01/linaro/qemu-for-merges/build/clang/qapi-types.c:3897:5
    #5 0x56308e827e19 in test_listen
/home/petmay01/linaro/qemu-for-merges/tests/test-sockets-proto.c:831:5
    #6 0x7f1cea6757da  (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x6f7da)
    #7 0x7f1cea6759a2  (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x6f9a2)
    #8 0x7f1cea6759a2  (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x6f9a2)
    #9 0x7f1cea6759a2  (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x6f9a2)
    #10 0x7f1cea675b7a in g_test_run_suite
(/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x6fb7a)
    #11 0x7f1cea675bd0 in g_test_run
(/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x6fbd0)
    #12 0x56308e82798d in main
/home/petmay01/linaro/qemu-for-merges/tests/test-sockets-proto.c:854:11
    #13 0x7f1ce860582f in __libc_start_main
/build/glibc-9tT8Do/glibc-2.23/csu/../csu/libc-start.c:291
    #14 0x56308e8053f8 in _start
(/home/petmay01/linaro/qemu-for-merges/build/clang/tests/test-sockets-proto+0xb93f8)

OK
PASS: tests/test-sockets-proto


This usually means "forgot to initialize a bool". May or may not
be the same bug in both cases...

thanks
-- PMM

Re: [Qemu-devel] [PULL v1 0/5] Merge sockets 2017/06/07
Posted by Daniel P. Berrange 8 years, 4 months ago
On Mon, Jun 12, 2017 at 02:14:19PM +0100, Peter Maydell wrote:
> On 7 June 2017 at 18:54, Daniel P. Berrange <berrange@redhat.com> wrote:
> > The following changes since commit 0db1851becbefe3e50cfc03776fb1f75817376af:
> >
> >   Merge remote-tracking branch 'remotes/vivier/tags/m68k-for-2.10-pull-request' into staging (2017-06-07 11:56:00 +0100)
> >
> > are available in the git repository at:
> >
> >   git://github.com/berrange/qemu tags/pull-sockets-2017-06-07-1
> >
> > for you to fetch changes up to 8dd2c27927b93aa352c43e8f0b9437f85d2f5f55:
> >
> >   tests: add functional test validating ipv4/ipv6 address flag handling (2017-06-07 17:15:08 +0100)
> >
> > ----------------------------------------------------------------
> > Merge sockets 2017/06/07 v1
> >
> > ----------------------------------------------------------------
> 
> Hi; I'm afraid this ran into 'make check' problems:
> 
> On OSX and FreeBSD:
>   GTESTER check-qtest-i386
> ERROR:/Users/pm215/src/qemu-for-merges/tests/test-sockets-proto.c:825:void
> test_listen(const void *): assertion failed: (data->ipv6 != 0)
> GTester: last random seed: R02Sc21fa7784ab13d0fd3274d86c5a52367
> **
> ERROR:/Users/pm215/src/qemu-for-merges/tests/test-sockets-proto.c:825:void
> test_listen(const void *): assertion failed: (data->ipv6 != 0)
> GTester: last random seed: R02Sdf653a63e8d9a5d03bfadb49122f3e9a
> 
> 
> 
> On the clang runtime undefined-behavior sanitizer:

Was this clang on OSX/FreeBSD too, or is that on Linux ? If the latter,
what are the args to use with configure to exercise this scenario ?

>   GTESTER check-qtest-i386
> /home/petmay01/linaro/qemu-for-merges/qapi/qapi-visit-core.c:139:12:
> runtime error: load of value 254, which is not a valid value for type
> 'bool'


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 :|

Re: [Qemu-devel] [PULL v1 0/5] Merge sockets 2017/06/07
Posted by Peter Maydell 8 years, 4 months ago
On 14 June 2017 at 09:26, Daniel P. Berrange <berrange@redhat.com> wrote:
> Was this clang on OSX/FreeBSD too, or is that on Linux ? If the latter,
> what are the args to use with configure to exercise this scenario ?

Linux. For details of how to run the sanitizer, see
http://wiki.qemu.org/Testing#clang_UBSan

thanks
-- PMM

Re: [Qemu-devel] [PULL v1 0/5] Merge sockets 2017/06/07
Posted by Daniel P. Berrange 8 years, 4 months ago
On Mon, Jun 12, 2017 at 02:14:19PM +0100, Peter Maydell wrote:
> On 7 June 2017 at 18:54, Daniel P. Berrange <berrange@redhat.com> wrote:
> > The following changes since commit 0db1851becbefe3e50cfc03776fb1f75817376af:
> >
> >   Merge remote-tracking branch 'remotes/vivier/tags/m68k-for-2.10-pull-request' into staging (2017-06-07 11:56:00 +0100)
> >
> > are available in the git repository at:
> >
> >   git://github.com/berrange/qemu tags/pull-sockets-2017-06-07-1
> >
> > for you to fetch changes up to 8dd2c27927b93aa352c43e8f0b9437f85d2f5f55:
> >
> >   tests: add functional test validating ipv4/ipv6 address flag handling (2017-06-07 17:15:08 +0100)
> >
> > ----------------------------------------------------------------
> > Merge sockets 2017/06/07 v1
> >
> > ----------------------------------------------------------------
> 
> Hi; I'm afraid this ran into 'make check' problems:
> 
> On OSX and FreeBSD:
>   GTESTER check-qtest-i386
> ERROR:/Users/pm215/src/qemu-for-merges/tests/test-sockets-proto.c:825:void
> test_listen(const void *): assertion failed: (data->ipv6 != 0)
> GTester: last random seed: R02Sc21fa7784ab13d0fd3274d86c5a52367
> **
> ERROR:/Users/pm215/src/qemu-for-merges/tests/test-sockets-proto.c:825:void
> test_listen(const void *): assertion failed: (data->ipv6 != 0)
> GTester: last random seed: R02Sdf653a63e8d9a5d03bfadb49122f3e9a

Ok, it appears that getaddrinfo() returns different results for "localhost"
on FreeBSD/OSX, compared to Linux. Linux returns IPv4 first, then IPv6,
while FreeBSD/OSX return IPv6 first then IPv4. The sockets code is working
correctly, but the unit test is not seeing the expected results, since its
data tables are expecting the Linux behaviour. Not sure how I'll fix this
yet, perhaps I'll just #ifdef __linux__ as a temporary hack.


> On the clang runtime undefined-behavior sanitizer:
>   GTESTER check-qtest-i386
> /home/petmay01/linaro/qemu-for-merges/qapi/qapi-visit-core.c:139:12:
> runtime error: load of value 254, which is not a valid value for type
> 'bool'
> 
> (ditto for check-qtest-ppc64, x86_64
>   GTESTER check-qtest-ppc64
> /home/petmay01/linaro/qemu-for-merges/qapi/qapi-visit-core.c:139:12:
> runtime error: load of value 254, which is not a valid value for type
> 'bool'

[snip]

> This usually means "forgot to initialize a bool". May or may not
> be the same bug in both cases...

Yes, this was a unit test bug using  g_new instead of g_new0

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 :|

Re: [Qemu-devel] [PULL v1 0/5] Merge sockets 2017/06/07
Posted by Philippe Mathieu-Daudé 8 years, 4 months ago
Hi Daniel,

On 06/14/2017 07:50 AM, Daniel P. Berrange wrote:
> On Mon, Jun 12, 2017 at 02:14:19PM +0100, Peter Maydell wrote:
>> On 7 June 2017 at 18:54, Daniel P. Berrange <berrange@redhat.com> wrote:
>>> The following changes since commit 0db1851becbefe3e50cfc03776fb1f75817376af:
>>>
>>>   Merge remote-tracking branch 'remotes/vivier/tags/m68k-for-2.10-pull-request' into staging (2017-06-07 11:56:00 +0100)
>>>
>>> are available in the git repository at:
>>>
>>>   git://github.com/berrange/qemu tags/pull-sockets-2017-06-07-1
>>>
>>> for you to fetch changes up to 8dd2c27927b93aa352c43e8f0b9437f85d2f5f55:
>>>
>>>   tests: add functional test validating ipv4/ipv6 address flag handling (2017-06-07 17:15:08 +0100)
>>>
>>> ----------------------------------------------------------------
>>> Merge sockets 2017/06/07 v1
>>>
>>> ----------------------------------------------------------------
>>
>> Hi; I'm afraid this ran into 'make check' problems:
>>
>> On OSX and FreeBSD:
>>   GTESTER check-qtest-i386
>> ERROR:/Users/pm215/src/qemu-for-merges/tests/test-sockets-proto.c:825:void
>> test_listen(const void *): assertion failed: (data->ipv6 != 0)
>> GTester: last random seed: R02Sc21fa7784ab13d0fd3274d86c5a52367
>> **
>> ERROR:/Users/pm215/src/qemu-for-merges/tests/test-sockets-proto.c:825:void
>> test_listen(const void *): assertion failed: (data->ipv6 != 0)
>> GTester: last random seed: R02Sdf653a63e8d9a5d03bfadb49122f3e9a
>
> Ok, it appears that getaddrinfo() returns different results for "localhost"
> on FreeBSD/OSX, compared to Linux. Linux returns IPv4 first, then IPv6,
> while FreeBSD/OSX return IPv6 first then IPv4. The sockets code is working
> correctly, but the unit test is not seeing the expected results, since its
> data tables are expecting the Linux behaviour. Not sure how I'll fix this
> yet, perhaps I'll just #ifdef __linux__ as a temporary hack.

On Linux it depends of your /etc/gai.conf(5), on FreeBSD it depends on 
ip6addrctl(8) policy.

I'm not sure about this hack, temporary tends to last...

>
>
>> On the clang runtime undefined-behavior sanitizer:
>>   GTESTER check-qtest-i386
>> /home/petmay01/linaro/qemu-for-merges/qapi/qapi-visit-core.c:139:12:
>> runtime error: load of value 254, which is not a valid value for type
>> 'bool'
>>
>> (ditto for check-qtest-ppc64, x86_64
>>   GTESTER check-qtest-ppc64
>> /home/petmay01/linaro/qemu-for-merges/qapi/qapi-visit-core.c:139:12:
>> runtime error: load of value 254, which is not a valid value for type
>> 'bool'
>
> [snip]
>
>> This usually means "forgot to initialize a bool". May or may not
>> be the same bug in both cases...
>
> Yes, this was a unit test bug using  g_new instead of g_new0
>
> Regards,
> Daniel
>

Re: [Qemu-devel] [PULL v1 0/5] Merge sockets 2017/06/07
Posted by Daniel P. Berrange 8 years, 4 months ago
On Wed, Jun 14, 2017 at 12:13:33PM -0300, Philippe Mathieu-Daudé wrote:
> Hi Daniel,
> 
> On 06/14/2017 07:50 AM, Daniel P. Berrange wrote:
> > On Mon, Jun 12, 2017 at 02:14:19PM +0100, Peter Maydell wrote:
> > > On 7 June 2017 at 18:54, Daniel P. Berrange <berrange@redhat.com> wrote:
> > > > The following changes since commit 0db1851becbefe3e50cfc03776fb1f75817376af:
> > > > 
> > > >   Merge remote-tracking branch 'remotes/vivier/tags/m68k-for-2.10-pull-request' into staging (2017-06-07 11:56:00 +0100)
> > > > 
> > > > are available in the git repository at:
> > > > 
> > > >   git://github.com/berrange/qemu tags/pull-sockets-2017-06-07-1
> > > > 
> > > > for you to fetch changes up to 8dd2c27927b93aa352c43e8f0b9437f85d2f5f55:
> > > > 
> > > >   tests: add functional test validating ipv4/ipv6 address flag handling (2017-06-07 17:15:08 +0100)
> > > > 
> > > > ----------------------------------------------------------------
> > > > Merge sockets 2017/06/07 v1
> > > > 
> > > > ----------------------------------------------------------------
> > > 
> > > Hi; I'm afraid this ran into 'make check' problems:
> > > 
> > > On OSX and FreeBSD:
> > >   GTESTER check-qtest-i386
> > > ERROR:/Users/pm215/src/qemu-for-merges/tests/test-sockets-proto.c:825:void
> > > test_listen(const void *): assertion failed: (data->ipv6 != 0)
> > > GTester: last random seed: R02Sc21fa7784ab13d0fd3274d86c5a52367
> > > **
> > > ERROR:/Users/pm215/src/qemu-for-merges/tests/test-sockets-proto.c:825:void
> > > test_listen(const void *): assertion failed: (data->ipv6 != 0)
> > > GTester: last random seed: R02Sdf653a63e8d9a5d03bfadb49122f3e9a
> > 
> > Ok, it appears that getaddrinfo() returns different results for "localhost"
> > on FreeBSD/OSX, compared to Linux. Linux returns IPv4 first, then IPv6,
> > while FreeBSD/OSX return IPv6 first then IPv4. The sockets code is working
> > correctly, but the unit test is not seeing the expected results, since its
> > data tables are expecting the Linux behaviour. Not sure how I'll fix this
> > yet, perhaps I'll just #ifdef __linux__ as a temporary hack.
> 
> On Linux it depends of your /etc/gai.conf(5), on FreeBSD it depends on
> ip6addrctl(8) policy.
> 
> I'm not sure about this hack, temporary tends to last...

Yeah, I'm thinking about a way to adapt the test suite to cope with
the arbitrary ordering, rather than assuming an "out of the box"
gai.conf setup.


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 :|