Commit graph

66895 commits

Author SHA1 Message Date
Alex Bennée d10404b193 tests: docker.py be even smarter with persistent binfmt_misc
If we have a persistent mapping we don't need the QEMU binary copied
into the container as the kernel has already opened the file and will
pass the fd in. However the support libraries will still need to be
there.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
2019-02-08 17:32:35 +00:00
Alex Bennée 43c898b75a tests: make docker.py check for persistent configs
binfmt_misc configured with the "F" flag opens the interpreter at
config time. This means it can use an already open file-descriptor to
run QEMU so there is no point trying to copy the binary into a
container.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
2019-02-08 17:32:35 +00:00
Alex Bennée 7e81d19840 tests: make docker.py update use configured binfmt path
When copying a QEMU binary into a linux-user docker image we should
check what the current configured binfmt_misc path is rather than
just assuming "/usr/bin/qemu-bin". Obviously if the user changes the
configuration afterwards they will break their images again.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
2019-02-08 17:32:35 +00:00
Alex Bennée d6db2a1cdf docker: add debian-buster-arm64-cross
We can't build QEMU with this but we can use this image to build newer
arm64 testcases which need more up to date tools.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
2019-02-08 17:32:35 +00:00
Philippe Mathieu-Daudé d3b442654c archive-source.sh: Clone the submodules locally
We cloned the QEMU repository from the local storage. Since the
submodules are also available there, clone them too. This is
quicker and reduce network use.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
[AJB: incorporated review suggestions from danpb]
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
2019-02-08 17:32:35 +00:00
Philippe Mathieu-Daudé 54dbfd8504 MAINTAINERS: Add an entry for scripts/archive-source.sh
The scripts/archive-source.sh is used by the VM tests, it makes
sense to add it in the "Build and test automation" section.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
2019-02-08 17:32:35 +00:00
Alex Bennée f3908ff792 .travis.yml: fold --disable-tcg into alternate coroutine builds
The alternate coroutine builds are really only of interest to people
running KVM (although I think you could use them for TCG if you really
tried). As they tend to run long lets kill two birds with one stone
and fold the --disable-tcg build into them.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
2019-02-08 17:32:35 +00:00
Alex Bennée 570f3c7728 .travis.yml: separate tools and docs into another entry
Re-building the tools and documents by default is a little wasteful as
they are not really affected by the main build options. Split tools
and documents into their own task with a minimal softmmu and
linux-user target list just to check they don't interact badly.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
2019-02-08 17:32:35 +00:00
Daniel P. Berrangé 83c3d1b417 .travis.yml: stop requesting libffi & gettext from homebrew
The default package set installed on macOS builders from Travis already
includes libffi and gettext as shown by log messages:

  Skipping install of libffi formula. It is already up-to-date.
  Using libffi
  Skipping install of gettext formula. It is already up-to-date.
  Using gettext

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
2019-02-08 17:32:35 +00:00
Ed Maste 7162fbb451 .cirrus.yml: basic compile and test for FreeBSD
Signed-off-by: Ed Maste <emaste@freebsd.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
2019-02-08 17:32:35 +00:00
Peter Maydell e47f81b617 More work towards libslirp
Marc-André Lureau (27):
   slirp: generalize guestfwd with a callback based approach
   net/slirp: simplify checking for cmd: prefix
   net/slirp: free forwarding rules on cleanup
   net/slirp: fix leaks on forwarding rule registration error
   slirp: add callbacks for timer
   slirp: replace trace functions with DEBUG calls
   slirp: replace QEMU_PACKED with SLIRP_PACKED
   slirp: replace most qemu socket utilities with slirp own version
   slirp: replace qemu_set_nonblock()
   slirp: add unregister_poll_fd() callback
   slirp: replace qemu_notify_event() with a callback
   slirp: move QEMU state saving to a separate unit
   slirp: do not include qemu headers in libslirp.h public API header
   slirp: improve windows headers inclusion
   slirp: add slirp own version of pstrcpy
   slirp: remove qemu timer.h dependency
   slirp: remove now useless QEMU headers inclusions
   slirp: replace net/eth.h inclusion with own defines
   slirp: replace qemu qtailq with slirp own copy
   slirp: replace remaining qemu headers dependency
   slirp: prefer c99 types over BSD kind
   slirp: improve send_packet() callback
   slirp: replace global polling with per-instance & notifier
   slirp: remove slirp_instances list
   slirp: use polling callbacks, drop glib requirement
   slirp: pass opaque to all callbacks
   slirp: API is extern C
 
 Peter Maydell (2):
   slirp: Avoid marking naturally packed structs as QEMU_PACKED
   slirp: Don't mark struct ipq or struct ipasfrag as packed
 
 Samuel Thibault (3):
   slirp: Avoid unaligned 16bit memory access
   slirp: replace QEMU_BUILD_BUG_ON with G_STATIC_ASSERT
   slirp: Move g_spawn_async_with_fds_qemu compatibility to slirp/
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEE5h27FdQXK97JfpLZ21UOifD6VPMFAlxcOoEACgkQ21UOifD6
 VPMXKRAAh30w8FcQVSTdnc1LXTbHaaWX0onlvqNpDNsoG8bUx9wacHYuLmuQ6v/w
 7VcrFeCyB0iEs4FZqLfB7eiyhTBzUgtDkjfqPzOq887xYv2Feml3ULLlFEtHRzPd
 ht+lYiOzF3XK0PUuqquYw+NhXOb5iYGOi8YfwAvuixQR72aq/yM/1QsNAq1a/xa8
 5TlymCYIDG1n7YCZlpWtCHcbo088WbAfFFeO+n/G0haunqYXdu9aha0d0QWClWJv
 LaufmdtECKeNTdm5o2HKIzluwWVujARJ0RjhkzvdUhDMvhYdw8G3S1UvG+dDIY3Z
 EqvVTqaeK7JiTrvx7tSOQ3bA/b1YXyMcWUCvVoBwGvTtiZenjXEH2eWrS8JI4OFn
 fDADP5UFBMQ4CLf5f6584fcjN9OP2Ux3e4n6tmTUO8QuuC3NS3NmuVR0Og3TcKdo
 ewdCuhQDIFo7Ez2ChzfAvIfu2j5B/PvE0MR/0y+0WSpBnSXcukYdOSe4657m+Fco
 4Ah9v7Nu/mrYAPqbGlaExQkAJJWUmR6oY1QP32/PTLZCFEsjMD7ZNOfKS0UVtZYT
 TV+thnj2nRARLJ7OwVTbiB+BliMmJLexc92tSAmUu65VgP3BEvUU1yR/lxodwX31
 9TNS3BzRNoen+oSAJAgEfpPo3HxQanhHRi8o5o+fk8kdOkwCxzA=
 =nIy1
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/thibault/tags/samuel-thibault' into staging

More work towards libslirp

Marc-André Lureau (27):
  slirp: generalize guestfwd with a callback based approach
  net/slirp: simplify checking for cmd: prefix
  net/slirp: free forwarding rules on cleanup
  net/slirp: fix leaks on forwarding rule registration error
  slirp: add callbacks for timer
  slirp: replace trace functions with DEBUG calls
  slirp: replace QEMU_PACKED with SLIRP_PACKED
  slirp: replace most qemu socket utilities with slirp own version
  slirp: replace qemu_set_nonblock()
  slirp: add unregister_poll_fd() callback
  slirp: replace qemu_notify_event() with a callback
  slirp: move QEMU state saving to a separate unit
  slirp: do not include qemu headers in libslirp.h public API header
  slirp: improve windows headers inclusion
  slirp: add slirp own version of pstrcpy
  slirp: remove qemu timer.h dependency
  slirp: remove now useless QEMU headers inclusions
  slirp: replace net/eth.h inclusion with own defines
  slirp: replace qemu qtailq with slirp own copy
  slirp: replace remaining qemu headers dependency
  slirp: prefer c99 types over BSD kind
  slirp: improve send_packet() callback
  slirp: replace global polling with per-instance & notifier
  slirp: remove slirp_instances list
  slirp: use polling callbacks, drop glib requirement
  slirp: pass opaque to all callbacks
  slirp: API is extern C

Peter Maydell (2):
  slirp: Avoid marking naturally packed structs as QEMU_PACKED
  slirp: Don't mark struct ipq or struct ipasfrag as packed

Samuel Thibault (3):
  slirp: Avoid unaligned 16bit memory access
  slirp: replace QEMU_BUILD_BUG_ON with G_STATIC_ASSERT
  slirp: Move g_spawn_async_with_fds_qemu compatibility to slirp/

# gpg: Signature made Thu 07 Feb 2019 14:02:41 GMT
# gpg:                using RSA key E61DBB15D4172BDEC97E92D9DB550E89F0FA54F3
# gpg: Good signature from "Samuel Thibault <samuel.thibault@aquilenet.fr>" [unknown]
# gpg:                 aka "Samuel Thibault <sthibault@debian.org>" [marginal]
# gpg:                 aka "Samuel Thibault <samuel.thibault@gnu.org>" [unknown]
# gpg:                 aka "Samuel Thibault <samuel.thibault@inria.fr>" [marginal]
# gpg:                 aka "Samuel Thibault <samuel.thibault@labri.fr>" [marginal]
# gpg:                 aka "Samuel Thibault <samuel.thibault@ens-lyon.org>" [marginal]
# gpg:                 aka "Samuel Thibault <samuel.thibault@u-bordeaux.fr>" [unknown]
# gpg: WARNING: This key is not certified with sufficiently trusted signatures!
# gpg:          It is not certain that the signature belongs to the owner.
# Primary key fingerprint: 900C B024 B679 31D4 0F82  304B D017 8C76 7D06 9EE6
#      Subkey fingerprint: E61D BB15 D417 2BDE C97E  92D9 DB55 0E89 F0FA 54F3

* remotes/thibault/tags/samuel-thibault: (32 commits)
  slirp: API is extern C
  slirp: pass opaque to all callbacks
  slirp: use polling callbacks, drop glib requirement
  slirp: remove slirp_instances list
  slirp: replace global polling with per-instance & notifier
  slirp: improve send_packet() callback
  slirp: prefer c99 types over BSD kind
  slirp: replace remaining qemu headers dependency
  slirp: Move g_spawn_async_with_fds_qemu compatibility to slirp/
  slirp: replace QEMU_BUILD_BUG_ON with G_STATIC_ASSERT
  slirp: replace qemu qtailq with slirp own copy
  slirp: replace net/eth.h inclusion with own defines
  slirp: remove now useless QEMU headers inclusions
  slirp: remove qemu timer.h dependency
  slirp: add slirp own version of pstrcpy
  slirp: improve windows headers inclusion
  slirp: do not include qemu headers in libslirp.h public API header
  slirp: move QEMU state saving to a separate unit
  slirp: replace qemu_notify_event() with a callback
  slirp: add unregister_poll_fd() callback
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2019-02-07 18:53:25 +00:00
Peter Maydell ff372bb5c4 - add new netlink type from linux v4.18 and v4.19
- fix coverity warning (CID 1390634)
 - fix ioctl(SIOCGIFCONF) crash
 -----BEGIN PGP SIGNATURE-----
 
 iQIcBAABAgAGBQJcXC7VAAoJEPMMOL0/L748KrMQALVIHaIwXFIF5l+GHBWnRKpN
 ApeignlyxCzy6s9wT9B8rw0JLgHu6DPeZ7D07A4VfQbN5G84IJ1uwqAOVXoHqAUe
 JfHYqGakhwbvueM4NjGzwS4o/OyjqsGOvnWtRM784rFTP8IHcgG15PxUYv3QUqpR
 BrpBEWImJJeBAulJ8F1CT0IU60wZNCf9XR9dSwSP0fwC9P+i38A0V7tfVJmnBNTA
 DrrXHop0MrHkrkvaAKKRA40VGxSXsXpjX90ACcsAdy4Qx3puIeh2BUaBZso/gcJP
 nCv6ks6YfbqDo4qoL0h/d0BElN3ZqynpFjrCLusn/pouLZYcwqW+rJfd7RY7uQrv
 8Fw/Y8NeRzbYej7ZqyAXDkhIBYp4NJt+jTaaUYRjGu2HT0pchaziQKCpAXfkV/+/
 m+3us3qesopkn6/O9BsCw5f2V4KYvjYVSs64u1bTsr6NRpi7dHHKztRCjcPhmxmj
 nkBcGPDgPlAwkHUraRBNsMkDQ3F5DFKL1xB/AHg2LIucXlzw/jP/HDgjzy73jiGq
 Jm4vQ2ETCzAWjVOgT6GsZx9vWj5p3dhL8OufkmNhk6WzSu4g4K1zoHTWNywFV/s3
 aUaIi4isYGpD3FCVjWTDKtpmtR58wKhBCpfW7jEmnNMLgzNGR37WmhYEGeuTjJ/i
 TTzqQ2hEVMNyQUgteTgg
 =ptgL
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/vivier2/tags/linux-user-for-4.0-pull-request' into staging

- add new netlink type from linux v4.18 and v4.19
- fix coverity warning (CID 1390634)
- fix ioctl(SIOCGIFCONF) crash

# gpg: Signature made Thu 07 Feb 2019 13:12:53 GMT
# gpg:                using RSA key F30C38BD3F2FBE3C
# gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>" [full]
# gpg:                 aka "Laurent Vivier <laurent@vivier.eu>" [full]
# gpg:                 aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>" [full]
# Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F  5173 F30C 38BD 3F2F BE3C

* remotes/vivier2/tags/linux-user-for-4.0-pull-request:
  linux-user: add new netlink types
  linux-user: Check sscanf return value in open_net_route()
  Fix linux-user crashes in ioctl(SIOCGIFCONF) when ifc_buf is NULL.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2019-02-07 18:18:24 +00:00
Peter Maydell d55451dcde qemu-sparc queue
-----BEGIN PGP SIGNATURE-----
 
 iQFSBAABCAA8FiEEzGIauY6CIA2RXMnEW8LFb64PMh8FAlxbUL4eHG1hcmsuY2F2
 ZS1heWxhbmRAaWxhbmRlLmNvLnVrAAoJEFvCxW+uDzIfwpYH/iaA9FLIS7Xkzg/X
 Ha4ADMUFYstUro+y4m55a7ULc7vVO92oEVAUyJmjCghjux+dyEws49V9EGli+53Q
 sGnXWkBHj1wmeLZ6VZGuFaU9JBdKGX3W2JfjwYzbsa84PhlonUlM3jqLqJpQQVSL
 DnHbs+8aSFKBA3gKlrDGCl5vkFTvfLtXNF+16UwjMjAVKdGO2udWcS6w+Lut28k0
 yt3HoqnXLv4voMA+Q3bSLinjWQlK7/mqL34zu1U/nQnSM5oW87WS7dp2ykk3Nav0
 GV60V+fsXmSLwJof3ZUbGAMSa8Ni51uUgH3hc4NBKFBn2uqIv/e2L/in01ZWhSzd
 vt3zwqo=
 =r5wm
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/mcayland/tags/qemu-sparc-20190206' into staging

qemu-sparc queue

# gpg: Signature made Wed 06 Feb 2019 21:25:18 GMT
# gpg:                using RSA key CC621AB98E82200D915CC9C45BC2C56FAE0F321F
# gpg:                issuer "mark.cave-ayland@ilande.co.uk"
# gpg: Good signature from "Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>" [full]
# Primary key fingerprint: CC62 1AB9 8E82 200D 915C  C9C4 5BC2 C56F AE0F 321F

* remotes/mcayland/tags/qemu-sparc-20190206:
  sun4m: pass initrd size to OpenBIOS via fw_cfg interface
  sun4u: add power_mem_read routine
  hw/sparc64: Create VGA device only if it has really been requested

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2019-02-07 16:49:30 +00:00
Peter Maydell 4f0444fc68 Trivial patches:
* Update copyright
 * Fix LGPL in target/moxie
 * configure portability fix
 * Drop useless inclusion of "hw/i386/pc.h"
 * Mark the cpu-cluster device with user_creatable = false
 * tsc210x: Fix building with no verbosity
 -----BEGIN PGP SIGNATURE-----
 
 iQIcBAABAgAGBQJcWvznAAoJEPMMOL0/L748NZYQAIPHJznGVSVLm9Zve7XE7FbV
 UivSMYmruTLIBxRtaeLY0wN0CBJXepasfx6KKaETgWtousvonoxsSF9p0ERn9nj8
 6bD7kHIIpZlqeReupLY+dWCqOX50GwAY1LdxtVjY/Svyiie53eUupJf0OPIpqxEU
 arIsYnicYWtknhtgU9ud9p/yRy7yzJFeDw9elhHv4pa/tHKtoqOwsB6mbaKyHR3p
 fT+lbCGf5PRnILY5/Ea5WIRi17v6JQzApnVhhcjX/3x7aSHkIehFo1sDPdr2vu/X
 lfPAONyBGmda90aOat/3sRdp8a1Ab0U836MXKMKgjKJgNACpsB41kFNycrIP08Xx
 oXpln03hIeZV5uGNUbcZ0YoniWwT58ktlH1WtL/ihnjOEetaprYCDhYr/LyBCCur
 gTWflJxrMaz6J5ohpCiKt0og+/FSKtzrtaBq/3e5ASY+FCU6CmV50ugkAb08cRIg
 8KwOPnU4tO1WGXLYGCZ4om3BssWSnFFHZ7Yrvvmyiyc1XRkU4HHLFARR/Uc1tP6+
 3O67UmCMlwnEgylGory/0EMNwG5vrOCeh9aGiytXhq6oxVK2cxDDO9KdPExvprnL
 bj2wUk5EaHesOGd04xoUfbxTFmNNOdAeQo7zX+4rOhi+7/3w2NlTpDTGH9LzfLGO
 x6NjOwyx3KC1ea7XonqK
 =YRrX
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/vivier2/tags/trivial-patches-pull-request' into staging

Trivial patches:
* Update copyright
* Fix LGPL in target/moxie
* configure portability fix
* Drop useless inclusion of "hw/i386/pc.h"
* Mark the cpu-cluster device with user_creatable = false
* tsc210x: Fix building with no verbosity

# gpg: Signature made Wed 06 Feb 2019 15:27:35 GMT
# gpg:                using RSA key F30C38BD3F2FBE3C
# gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>" [full]
# gpg:                 aka "Laurent Vivier <laurent@vivier.eu>" [full]
# gpg:                 aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>" [full]
# Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F  5173 F30C 38BD 3F2F BE3C

* remotes/vivier2/tags/trivial-patches-pull-request:
  hw/input/tsc210x: Fix building with no verbosity
  hw/cpu/cluster: Mark the cpu-cluster device with user_creatable = false
  hw/unicore32/puv3: Drop useless inclusion of "hw/i386/pc.h"
  hw/sparc64/sun4u: Drop useless inclusion of "hw/i386/pc.h"
  configure: Avoid non-portable 'test -o/-a'
  target/moxie: Fix LGPL information in the file headers
  qemu-common.h: Update copyright string for 2019

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2019-02-07 14:59:59 +00:00
Peter Maydell 632351e0e1 Pull request
-----BEGIN PGP SIGNATURE-----
 
 iQIcBAABAgAGBQJcWvXyAAoJENro4Ql1lpzlm5UP/2oOYoDKpEe4me+enqMeMVB2
 EgrYpaIG3SO0pxNXlf7iX//w0VNTDTIeXiMTx7e5cQo08oL0fnfL1T+UfnX2bZnC
 uEKGdzI1l/FoZNUy5VoAGidSN6ImyYL+84t8l7AlVWoPTrVvxM6LYD8a4rWQKOQz
 a9i5VbGtdrzw7Bfif9dwqhqNJA7/HgsFBO9hek9mdTY+yUzR3Ba8SdEijZ076M/8
 iRUS9eLGuZwK/cu3ID8GLrpEuN4pfrslRKqpMsW5G0ozcmFUiguPwczdjvOz3Sgy
 NjkaYuFh4vJCdjEU73rAdX/R8Ea/nxLcZD60PYW+kBWgQW4vt+Kxrs6FosYU8IbW
 DPKidpKzLEQYCFJidTdgFXYDeHJtjY2MV4bOHEiqtch2zGDbAc+y0UdE5MrgIXe2
 9BtyZ/6ncgzTvUR8J0xQZV85KSjOwiYYcGmr4hXmYcJW4M9qqG8sft6Hb+rCdzay
 DKKz41OAkI+4wAVCe5kr0NnFNsiO+Pw+lBdjRjQJPh94Yb5cQGqmcha1EEfA2Qjd
 vJ+/NssOOPhxnTkkaRZ6MJsubyyagqbX/Cei4mE29anr8YuT8kJCUkmz/6h85AKK
 xsTbYi+iH0r7fJr7TXB2kOMwSRGzgFEsqJ+rZ0Hfj/Jisj0Yqbd1w7GXxnE52VUc
 +dtBNdMB7l3Os48KQYHn
 =zmV0
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/elmarco/tags/dump-pull-request' into staging

Pull request

# gpg: Signature made Wed 06 Feb 2019 14:57:54 GMT
# gpg:                using RSA key DAE8E10975969CE5
# gpg: Good signature from "Marc-André Lureau <marcandre.lureau@redhat.com>" [full]
# gpg:                 aka "Marc-André Lureau <marcandre.lureau@gmail.com>" [full]
# Primary key fingerprint: 87A9 BD93 3F87 C606 D276  F62D DAE8 E109 7596 9CE5

* remotes/elmarco/tags/dump-pull-request:
  dump: Set correct vaddr for ELF dump

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2019-02-07 14:20:46 +00:00
Marc-André Lureau ee261c0233 slirp: API is extern C
Make it possible to use headers easily with C++ projects.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-02-07 15:49:08 +02:00
Marc-André Lureau 3e0fad3aa5 slirp: pass opaque to all callbacks
This is friendlier for FFI bindings.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-02-07 15:49:08 +02:00
Marc-André Lureau deaeb3f71d slirp: use polling callbacks, drop glib requirement
It would be legitimate to use libslirp without glib. Let's
add_poll/get_revents pair of callbacks to provide the same
functionality.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-02-07 15:49:08 +02:00
Marc-André Lureau 6e513a78ea slirp: remove slirp_instances list
Now that polling is done per-instance, we don't need a global list of
slirp instances.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-02-07 15:49:08 +02:00
Marc-André Lureau 1ab67b98cd slirp: replace global polling with per-instance & notifier
Remove hard-coded dependency on slirp in main-loop, and use a "poll"
notifier instead. The notifier is registered per slirp instance.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-02-07 15:49:08 +02:00
Marc-André Lureau 625a526b32 slirp: improve send_packet() callback
Use a more descriptive name for the callback.

Reuse the SlirpWriteCb type. Wrap it to check that all data has been written.

Return a ssize_t for potential error handling and data-loss reporting.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-02-07 15:49:08 +02:00
Marc-André Lureau d7df0b41dc slirp: prefer c99 types over BSD kind
Replace:
- u_char -> uint8_t
- u_short -> uint16_t
- u_long -> uint32_t
- u_int -> unsigned
- caddr_t -> char *

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-02-07 15:49:08 +02:00
Marc-André Lureau a9d8b3ec43 slirp: replace remaining qemu headers dependency
Except for the migration code which is gated by WITH_QEMU, only
include our own headers, so libslirp can be built standalone.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-02-07 15:49:08 +02:00
Samuel Thibault 4ffa6325d1 slirp: Move g_spawn_async_with_fds_qemu compatibility to slirp/
Only slirp actually needs it, and will need it along in libslirp.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2019-02-07 15:49:08 +02:00
Samuel Thibault 85a0e43c45 slirp: replace QEMU_BUILD_BUG_ON with G_STATIC_ASSERT
to remove another dependency on qemu.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
2019-02-07 15:49:08 +02:00
Marc-André Lureau 918f38d037 slirp: replace qemu qtailq with slirp own copy
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-02-07 15:49:08 +02:00
Marc-André Lureau c1c5c0ff9e slirp: replace net/eth.h inclusion with own defines
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-02-07 15:49:08 +02:00
Marc-André Lureau e44203db9d slirp: remove now useless QEMU headers inclusions
Some of those could have been squashed earlier, but it is easier to do
it all here.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: samuel Thibault <samuel.thibault@ens-lyon.org>
2019-02-07 15:49:08 +02:00
Marc-André Lureau 759c5a6ab5 slirp: remove qemu timer.h dependency
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-02-07 15:49:08 +02:00
Marc-André Lureau d1c4b3e97d slirp: add slirp own version of pstrcpy
Remove a dependency on qemu util.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-02-07 15:49:08 +02:00
Marc-André Lureau ba1be96531 slirp: improve windows headers inclusion
Our API usage requires Vista, set WIN32_LEAN_AND_MEAN to fix a number
of issues (winsock2.h include order for ex, which is better to include
first for legacy reasons).

While at it, group redundants #ifndef _WIN32 blocks.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-02-07 15:49:08 +02:00
Marc-André Lureau 35ee75f343 slirp: do not include qemu headers in libslirp.h public API header
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-02-07 15:49:08 +02:00
Marc-André Lureau 268c95d771 slirp: move QEMU state saving to a separate unit
Make state saving optional: this will allow to build SLIRP without
QEMU. (eventually, the vmstate helpers will be extracted, so an
external project & process could save its state)

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-02-07 15:49:08 +02:00
Marc-André Lureau c21d959440 slirp: replace qemu_notify_event() with a callback
Introduce a SlirpCb callback to kick the main io-thread.

Add an intermediary sodrop() function that will call SlirpCb.notify
callback when sbdrop() returns true.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-02-07 15:49:08 +02:00
Marc-André Lureau f6e5aa366f slirp: add unregister_poll_fd() callback
Add a counter-part to register_poll_fd() for completeness.

(so far, register_poll_fd() is called only on struct socket fd)

Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-02-07 15:49:08 +02:00
Marc-André Lureau 848c7092ba slirp: replace qemu_set_nonblock()
Replace qemu_set_nonblock() with slirp_set_nonblock()

qemu_set_nonblock() does some event registration with the main
loop. Add a new callback register_poll_fd() for that reason.

Always build the fd-register stub, to avoid #if WIN32.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-02-07 15:49:08 +02:00
Marc-André Lureau 707bd47ef3 slirp: replace most qemu socket utilities with slirp own version
qemu_set_nonblock() is slightly more problematic and will be dealt
with in a separate patch.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-02-07 15:49:08 +02:00
Marc-André Lureau 9032941640 slirp: replace QEMU_PACKED with SLIRP_PACKED
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-02-07 15:49:08 +02:00
Marc-André Lureau 7fce71723b slirp: replace trace functions with DEBUG calls
Remove a dependency on QEMU. Use the existing logging facilities.
Set SLIRP_DEBUG=tftp to get tftp log.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-02-07 15:49:08 +02:00
Marc-André Lureau 07abf6d43a slirp: add callbacks for timer
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-02-07 15:49:08 +02:00
Marc-André Lureau 8e207c327c net/slirp: fix leaks on forwarding rule registration error
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-02-07 15:49:08 +02:00
Marc-André Lureau 8d45a3b946 net/slirp: free forwarding rules on cleanup
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-02-07 15:49:08 +02:00
Marc-André Lureau 3624730a32 net/slirp: simplify checking for cmd: prefix
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-02-07 15:49:08 +02:00
Marc-André Lureau 44b4ff2488 slirp: generalize guestfwd with a callback based approach
Instead of calling into QEMU chardev directly, and mixing it with
slirp_add_exec() handling, add a new function slirp_add_guestfwd()
which takes a write callback.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-02-07 15:49:08 +02:00
Peter Maydell aaa0c642b1 slirp: Don't mark struct ipq or struct ipasfrag as packed
There is no reason to mark the struct ipq and struct ipasfrag as
packed: they are naturally aligned anyway, and are not representing
any on-the-wire packet format.  Indeed they vary in size depending on
the size of pointers on the host system, because the 'struct qlink'
members include 'void *' fields.

Dropping the 'packed' annotation fixes clang -Waddress-of-packed-member
warnings and probably lets the compiler generate better code too.

The only thing we do care about in the layout of the struct is
that the frag_link matches up with the ipf_link of the struct
ipasfrag, as documented in the comment on that struct; assert
at build time that this is the case.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-02-07 15:49:08 +02:00
Peter Maydell c74e3ae9c8 slirp: Avoid marking naturally packed structs as QEMU_PACKED
Various ipv6 structs in the slirp headers are marked QEMU_PACKED,
but they are actually naturally aligned and will have no padding
in them. Instead of marking them with the 'packed' attribute,
assert at compile time that they are the size we expect. This
allows us to take the address of fields within the structs
without risking undefined behaviour, and suppresses clang
-Waddress-of-packed-member warnings.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2019-02-07 15:49:08 +02:00
Samuel Thibault 59fa06ac74 slirp: Avoid unaligned 16bit memory access
pkt parameter may be unaligned, so we must access it byte-wise.

This fixes sparc64 host SIGBUS during pxe boot.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
2019-02-07 15:49:08 +02:00
Laurent Vivier 0f5faca782 linux-user: add new netlink types
Add QEMU_IFLA_MIN_MTU, QEMU_IFLA_MAX_MTU (from linux v4.19)
    QEMU_IFLA_BRPORT_ISOLATED (from linux v4.18) and
    QEMU_IFLA_BRPORT_BACKUP_PORT (from linux v4.19).

These new types fix this error flow with sudo:
...
Unknown host QEMU_IFLA type: 50
Unknown host QEMU_IFLA type: 51
Unknown QEMU_IFLA_BRPORT type 33
...

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20190206193211.6683-1-laurent@vivier.eu>
2019-02-07 14:11:19 +01:00
Peter Maydell 9d0bd0cdd0 linux-user: Check sscanf return value in open_net_route()
Coverity warns (CID 1390634) that open_net_route() is not
checking the return value from sscanf(), which means that
it might then use values that aren't initialized.

Errors here should in general not happen since we're passing
an assumed-good /proc/net/route from the host kernel, but
if we do fail to parse a line then just skip it in the output
we pass to the guest.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20190205174207.9278-1-peter.maydell@linaro.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-02-07 14:11:19 +01:00
Kan Li 22e4a267a6 Fix linux-user crashes in ioctl(SIOCGIFCONF) when ifc_buf is NULL.
Summary:
This is to fix bug https://bugs.launchpad.net/qemu/+bug/1796754.
It is valid for ifc_buf to be NULL according to
http://man7.org/linux/man-pages/man7/netdevice.7.html.

Signed-off-by: Kan Li <likan_999.student@sina.com>
Reviewed-by: Laurent Vivier <lvivier@redhat.com>
Message-Id: <20181024201303.114-1-likan_999.student@sina.com>
[lv: fix errors reported by checkpatch.pl]
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-02-07 14:04:03 +01:00