Skip to contentSkip to conversation

Remove the slirp submodule (and only compile with an external libslirp)

RFC PATCH In review Thomas Huth 5 participants 11 messages Apr 8, 2022 – Apr 23, 2022 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 Remove the slirp submodule (and only compile with an external libslirp)

QEMU 7.1 won't support Ubuntu 18.04 anymore, so the last big important distro that did not have a pre-packaged libslirp has been dismissed. All other major distros seem to have a libslirp package in their distribution already - according to repology.org:

          Fedora 34: 4.4.0
  CentOS 8 (RHEL-8): 4.4.0
      Debian Buster: 4.3.1 (in buster-backports)
 OpenSUSE Leap 15.3: 4.3.1
   Ubuntu LTS 20.04: 4.1.0
      FreeBSD Ports: 4.6.1
      NetBSD pkgsrc: 4.3.1
           Homebrew: 4.6.1
        MSYS2 mingw: 4.6.1

The only one that still seems to be missing a libslirp package is OpenBSD - but I assume that they can add it to their ports system quickly if required.

So there is no real urgent need for keeping the slirp submodule in the QEMU tree anymore. Thus let's drop the slirp submodule now and rely on the libslirp packages from the distributions instead.

---
 configure                     |  22 +------
 meson.build                   | 112 +++++-----------------------------
 .gitlab-ci.d/buildtest.yml    |  19 +++---
 .gitmodules                   |   3 -
 MAINTAINERS                   |   1 -
 meson_options.txt             |   5 +-
 scripts/archive-source.sh     |   2 +-
 scripts/meson-buildoptions.sh |   4 +-
 slirp                         |   1 -
 9 files changed, 29 insertions(+), 140 deletions(-)
 delete mode 160000 slirp
configure +1 -21
index 7c08c18358..3aedff78a9 100755
@@ -339,10 +339,8 @@ skip_meson=no
 # 1. Track which submodules are needed
 if test "$default_feature" = no ; then
   capstone="disabled"
-  slirp="disabled"
 else
   capstone="auto"
-  slirp="auto"
 fi
 fdt="auto"
 
@@ -874,14 +872,6 @@ for opt do
   ;;
   --disable-tsan) tsan="no"
   ;;
-  --disable-slirp) slirp="disabled"
-  ;;
-  --enable-slirp) slirp="enabled"
-  ;;
-  --enable-slirp=git) slirp="internal"
-  ;;
-  --enable-slirp=*) slirp="$optarg"
-  ;;
   --disable-xen) xen="disabled"
   ;;
   --enable-xen) xen="enabled"
@@ -2576,16 +2566,6 @@ EOF
   fi
 fi
 
-##########################################
-# check for slirp
-
-case "$slirp" in
-  auto | enabled | internal)
-    # Simpler to always update submodule, even if not needed.
-    git_submodules="${git_submodules} slirp"
-    ;;
-esac
-
 ##########################################
 # check for usable __NR_keyctl syscall
 
@@ -3169,7 +3149,7 @@ if test "$skip_meson" = no; then
         -Db_pie=$(if test "$pie" = yes; then echo true; else echo false; fi) \
         -Db_coverage=$(if test "$gcov" = yes; then echo true; else echo false; fi) \
         -Db_lto=$lto -Dcfi=$cfi -Dtcg=$tcg -Dxen=$xen \
-        -Dcapstone=$capstone -Dfdt=$fdt -Dslirp=$slirp \
+        -Dcapstone=$capstone -Dfdt=$fdt \
         $(test -n "${LIB_FUZZING_ENGINE+xxx}" && echo "-Dfuzzing_engine=$LIB_FUZZING_ENGINE") \
         $(if test "$default_feature" = no; then echo "-Dauto_features=disabled"; fi) \
         "$@" $cross_arg "$PWD" "$source_path"
meson.build +16 -96

136 lines not on this page · raw message

.gitlab-ci.d/buildtest.yml +8 -11
index 0aea7ab84c..19dc9f4590 100644
@@ -41,7 +41,7 @@ build-system-ubuntu:
     job: amd64-ubuntu2004-container
   variables:
     IMAGE: ubuntu2004
-    CONFIGURE_ARGS: --enable-docs --enable-fdt=system --enable-slirp=system
+    CONFIGURE_ARGS: --enable-docs --enable-fdt=system
     TARGETS: aarch64-softmmu alpha-softmmu cris-softmmu hppa-softmmu
       microblazeel-softmmu mips64el-softmmu
     MAKE_CHECK_ARGS: check-build
@@ -118,7 +118,7 @@ build-system-fedora:
   variables:
     IMAGE: fedora
     CONFIGURE_ARGS: --disable-gcrypt --enable-nettle --enable-docs
-             --enable-fdt=system --enable-slirp=system --enable-capstone=system
+             --enable-fdt=system --enable-capstone=system
     TARGETS: tricore-softmmu microblaze-softmmu mips-softmmu
       xtensa-softmmu m68k-softmmu riscv32-softmmu ppc-softmmu sparc64-softmmu
     MAKE_CHECK_ARGS: check-build
@@ -335,10 +335,8 @@ clang-user:
 # On gitlab runners, default value sometimes end up calling 2 lds concurrently and
 # triggers an Out-Of-Memory error
 #
-# Since slirp callbacks are used in QEMU Timers, slirp needs to be compiled together
-# with QEMU and linked as a static library to avoid false positives in CFI checks.
-# This can be accomplished by using -enable-slirp=git, which avoids the use of
-# a system-wide version of the library
+# Since slirp callbacks are used in QEMU Timers, we cannot use libslirp with
+# CFI builds, and thus have to disable it here.
 #
 # Split in three sets of build/check/avocado to limit the execution time of each
 # job
@@ -351,7 +349,7 @@ build-cfi-aarch64:
     AR: llvm-ar
     IMAGE: fedora
     CONFIGURE_ARGS: --cc=clang --cxx=clang++ --enable-cfi --enable-cfi-debug
-      --enable-safe-stack --enable-slirp=git
+      --enable-safe-stack --disable-slirp
     TARGETS: aarch64-softmmu
     MAKE_CHECK_ARGS: check-build
   timeout: 70m
@@ -393,7 +391,7 @@ build-cfi-ppc64-s390x:
     AR: llvm-ar
     IMAGE: fedora
     CONFIGURE_ARGS: --cc=clang --cxx=clang++ --enable-cfi --enable-cfi-debug
-      --enable-safe-stack --enable-slirp=git
+      --enable-safe-stack --disable-slirp
     TARGETS: ppc64-softmmu s390x-softmmu
     MAKE_CHECK_ARGS: check-build
   timeout: 70m
@@ -435,7 +433,7 @@ build-cfi-x86_64:
     AR: llvm-ar
     IMAGE: fedora
     CONFIGURE_ARGS: --cc=clang --cxx=clang++ --enable-cfi --enable-cfi-debug
-      --enable-safe-stack --enable-slirp=git
+      --enable-safe-stack --disable-slirp
     TARGETS: x86_64-softmmu
     MAKE_CHECK_ARGS: check-build
   timeout: 70m
@@ -469,7 +467,7 @@ tsan-build:
   variables:
     IMAGE: ubuntu2004
     CONFIGURE_ARGS: --enable-tsan --cc=clang-10 --cxx=clang++-10
-          --enable-trace-backends=ust --enable-fdt=system --enable-slirp=system
+          --enable-trace-backends=ust --enable-fdt=system --disable-slirp
     TARGETS: x86_64-softmmu ppc64-softmmu riscv64-softmmu x86_64-linux-user
     MAKE_CHECK_ARGS: bench V=1
 
@@ -571,7 +569,6 @@ build-without-default-features:
       --disable-capstone
       --disable-pie
       --disable-qom-cast-debug
-      --disable-slirp
       --disable-strip
     TARGETS: avr-softmmu i386-softmmu mips64-softmmu s390x-softmmu sh4-softmmu
       sparc64-softmmu hexagon-linux-user i386-linux-user s390x-linux-user
.gitmodules +0 -3
index f4b6a9b401..d55cdb5036 100644
@@ -49,9 +49,6 @@
 [submodule "roms/edk2"]
 	path = roms/edk2
 	url = https://gitlab.com/qemu-project/edk2.git
-[submodule "slirp"]
-	path = slirp
-	url = https://gitlab.com/qemu-project/libslirp.git
 [submodule "roms/opensbi"]
 	path = roms/opensbi
 	url = 	https://gitlab.com/qemu-project/opensbi.git
MAINTAINERS +0 -1
index 4ad2451e03..9a4fa68cc0 100644
@@ -2924,7 +2924,6 @@ F: include/hw/registerfields.h
 SLIRP
 M: Samuel Thibault <[email protected]>
 S: Maintained
-F: slirp/
 F: net/slirp.c
 F: include/net/slirp.h
 T: git https://people.debian.org/~sthibault/qemu.git slirp
meson_options.txt +2 -3
index 52b11cead4..668c859d84 100644
@@ -173,6 +173,8 @@ option('l2tpv3', type : 'feature', value : 'auto',
        description: 'l2tpv3 network backend support')
 option('netmap', type : 'feature', value : 'auto',
        description: 'netmap network backend support')
+option('slirp', type: 'feature', value: 'auto',
+       description: 'libslirp user mode network backend support')
 option('vde', type : 'feature', value : 'auto',
        description: 'vde network backend support')
 option('virglrenderer', type : 'feature', value : 'auto',
@@ -223,9 +225,6 @@ option('virtiofsd', type: 'feature', value: 'auto',
 option('capstone', type: 'combo', value: 'auto',
        choices: ['disabled', 'enabled', 'auto', 'system', 'internal'],
        description: 'Whether and how to find the capstone library')
-option('slirp', type: 'combo', value: 'auto',
-       choices: ['disabled', 'enabled', 'auto', 'system', 'internal'],
-       description: 'Whether and how to find the slirp library')
 option('fdt', type: 'combo', value: 'auto',
        choices: ['disabled', 'enabled', 'auto', 'system', 'internal'],
        description: 'Whether and how to find the libfdt library')
scripts/archive-source.sh +1 -1
index c6169db69f..23e042dacd 100755
@@ -26,7 +26,7 @@ sub_file="${sub_tdir}/submodule.tar"
 # independent of what the developer currently has initialized
 # in their checkout, because the build environment is completely
 # different to the host OS.
-submodules="dtc slirp meson ui/keycodemapdb"
+submodules="dtc meson ui/keycodemapdb"
 submodules="$submodules tests/fp/berkeley-softfloat-3 tests/fp/berkeley-testfloat-3"
 sub_deinit=""
 
scripts/meson-buildoptions.sh +1 -3
index 1e26f4571e..dcfecb69ad 100644
@@ -23,8 +23,6 @@ meson_options_help() {
   printf "%s\n" '  --enable-qom-cast-debug  cast debugging support'
   printf "%s\n" '  --enable-rng-none        dummy RNG, avoid using /dev/(u)random and'
   printf "%s\n" '                           getrandom()'
-  printf "%s\n" '  --enable-slirp[=CHOICE]  Whether and how to find the slirp library'
-  printf "%s\n" '                           (choices: auto/disabled/enabled/internal/system)'
   printf "%s\n" '  --enable-strip           Strip targets on install'
   printf "%s\n" '  --enable-tcg-interpreter TCG with bytecode interpreter (slow)'
   printf "%s\n" '  --enable-trace-backends=CHOICE'
@@ -103,6 +101,7 @@ meson_options_help() {
   printf "%s\n" '  sdl-image       SDL Image support for icons'
   printf "%s\n" '  seccomp         seccomp support'
   printf "%s\n" '  selinux         SELinux support in qemu-nbd'
+  printf "%s\n" '  slirp           libslirp user mode network backend support'
   printf "%s\n" '  slirp-smbd      use smbd (at path --smbd=*) in slirp networking'
   printf "%s\n" '  smartcard       CA smartcard emulation support'
   printf "%s\n" '  snappy          snappy compression support'
@@ -303,7 +302,6 @@ _meson_option_parse() {
     --disable-selinux) printf "%s" -Dselinux=disabled ;;
     --enable-slirp) printf "%s" -Dslirp=enabled ;;
     --disable-slirp) printf "%s" -Dslirp=disabled ;;
-    --enable-slirp=*) quote_sh "-Dslirp=$2" ;;
     --enable-slirp-smbd) printf "%s" -Dslirp_smbd=enabled ;;
     --disable-slirp-smbd) printf "%s" -Dslirp_smbd=disabled ;;
     --enable-smartcard) printf "%s" -Dsmartcard=enabled ;;
slirp deleted +0 -1
deleted file mode 160000
index a88d9ace23..0000000000
@@ -1 +0,0 @@
-Subproject commit a88d9ace234a24ce1c17189642ef9104799425e0
Signature · 1 line
2.27.0
#1 lore raw
Quoted 19 lines · Thomas Huth

QEMU 7.1 won't support Ubuntu 18.04 anymore, so the last big important distro that did not have a pre-packaged libslirp has been dismissed. All other major distros seem to have a libslirp package in their distribution already - according to repology.org:

           Fedora 34: 4.4.0
   CentOS 8 (RHEL-8): 4.4.0
       Debian Buster: 4.3.1 (in buster-backports)
  OpenSUSE Leap 15.3: 4.3.1
    Ubuntu LTS 20.04: 4.1.0
       FreeBSD Ports: 4.6.1
       NetBSD pkgsrc: 4.3.1
            Homebrew: 4.6.1
         MSYS2 mingw: 4.6.1

The only one that still seems to be missing a libslirp package is OpenBSD - but I assume that they can add it to their ports system quickly if required.

Quoted 5 lines

So there is no real urgent need for keeping the slirp submodule in the QEMU tree anymore. Thus let's drop the slirp submodule now and rely on the libslirp packages from the distributions instead.

I wish I had seen this earlier as our 7.1 release was just tagged.

I have whipped up a port of 4.6.1 for OpenBSD as it was pretty simple. I will see about submitting it in a number of days when the tree opens.

#2 lore raw
Quoted 21 lines · Brad Smith
Quoted 15 lines · Thomas Huth

QEMU 7.1 won't support Ubuntu 18.04 anymore, so the last big important distro that did not have a pre-packaged libslirp has been dismissed. All other major distros seem to have a libslirp package in their distribution already - according to repology.org:

           Fedora 34: 4.4.0
   CentOS 8 (RHEL-8): 4.4.0
       Debian Buster: 4.3.1 (in buster-backports)
  OpenSUSE Leap 15.3: 4.3.1
    Ubuntu LTS 20.04: 4.1.0
       FreeBSD Ports: 4.6.1
       NetBSD pkgsrc: 4.3.1
            Homebrew: 4.6.1
         MSYS2 mingw: 4.6.1
Quoted 3 lines

The only one that still seems to be missing a libslirp package is OpenBSD - but I assume that they can add it to their ports system quickly if required.

Quoted 5 lines

I wish I had seen this earlier as our 7.1 release was just tagged.

I have whipped up a port of 4.6.1 for OpenBSD as it was pretty simple. I will
see about submitting it in a number of days when the tree opens.

How awkward would it be for an end-user who's on OpenBSD 7.1 to build a QEMU that doesn't have libslirp? (That is, is it easy and common for an end user to pull in a port of libslirp that only came along in a later OpenBSD, or would they instead have to manually compile libslirp themselves from the upstream sources?)

(I'm asking here because if it's painful, then we should perhaps defer dropping our submodule copy of libslirp a little longer.)

thanks
-- PMM

#3 lore raw
Quoted 31 lines · Peter Maydell
Quoted 16 lines · Brad Smith
Quoted 15 lines · Thomas Huth

QEMU 7.1 won't support Ubuntu 18.04 anymore, so the last big important distro that did not have a pre-packaged libslirp has been dismissed. All other major distros seem to have a libslirp package in their distribution already - according to repology.org:

            Fedora 34: 4.4.0
    CentOS 8 (RHEL-8): 4.4.0
        Debian Buster: 4.3.1 (in buster-backports)
   OpenSUSE Leap 15.3: 4.3.1
     Ubuntu LTS 20.04: 4.1.0
        FreeBSD Ports: 4.6.1
        NetBSD pkgsrc: 4.3.1
             Homebrew: 4.6.1
          MSYS2 mingw: 4.6.1
Quoted 8 lines
Quoted 3 lines

The only one that still seems to be missing a libslirp package is OpenBSD - but I assume that they can add it to their ports system quickly if required.

I wish I had seen this earlier as our 7.1 release was just tagged.

I have whipped up a port of 4.6.1 for OpenBSD as it was pretty simple. I will
see about submitting it in a number of days when the tree opens.

How awkward would it be for an end-user who's on OpenBSD 7.1 to build a QEMU that doesn't have libslirp? (That is, is it easy and common for an end user to pull in a port of libslirp that only came along in a later OpenBSD, or would they instead have to manually compile libslirp themselves from the upstream sources?)

Quoted 5 lines

(I'm asking here because if it's painful, then we should perhaps defer dropping our submodule copy of libslirp a little longer.)

thanks
-- PMM

They would have to pull down a -current ports tree and build it. No package would exist for the release. It is possible, but not "supported". I have not looked at the CI bits to see how difficult that would be.

Our release cycles are 6 months and the next release will be in the middle of October.

#4 lore raw
Quoted 38 lines · Brad Smith
Quoted 31 lines · Peter Maydell
Quoted 16 lines · Brad Smith
Quoted 15 lines · Thomas Huth

QEMU 7.1 won't support Ubuntu 18.04 anymore, so the last big important distro that did not have a pre-packaged libslirp has been dismissed. All other major distros seem to have a libslirp package in their distribution already - according to repology.org:

            Fedora 34: 4.4.0
    CentOS 8 (RHEL-8): 4.4.0
        Debian Buster: 4.3.1 (in buster-backports) OpenSUSE Leap 15.3: 4.3.1
     Ubuntu LTS 20.04: 4.1.0
        FreeBSD Ports: 4.6.1
        NetBSD pkgsrc: 4.3.1
             Homebrew: 4.6.1
          MSYS2 mingw: 4.6.1

Quoted 8 lines
Quoted 3 lines

The only one that still seems to be missing a libslirp package is OpenBSD - but I assume that they can add it to their ports system quickly if required.

I wish I had seen this earlier as our 7.1 release was just tagged.

I have whipped up a port of 4.6.1 for OpenBSD as it was pretty simple. I will
see about submitting it in a number of days when the tree opens.

How awkward would it be for an end-user who's on OpenBSD 7.1 to build a QEMU that doesn't have libslirp? (That is, is it easy and common for an end user to pull in a port of libslirp that only came along in a later OpenBSD, or would they instead have to manually compile libslirp themselves from the upstream sources?)

Quoted 5 lines

(I'm asking here because if it's painful, then we should perhaps defer dropping our submodule copy of libslirp a little longer.)

thanks
-- PMM

Quoted 6 lines

They would have to pull down a -current ports tree and build it. No package would exist for the release. It is possible, but not "supported". I have not looked at the CI bits to see how difficult that would be.

Our release cycles are 6 months and the next release will be in the middle of October.

OK, thanks for the update, Brad ... so I guess we should defer this patch to QEMU 7.2 (to be released in december) instead? (which would be fine for me - I just wanted to get the discussion started, that's also why I've marked this patch as RFC)

Thomas

#5 lore raw
Quoted 43 lines · Thomas Huth
Quoted 42 lines · Brad Smith
Quoted 31 lines · Peter Maydell
Quoted 16 lines · Brad Smith
Quoted 15 lines · Thomas Huth

QEMU 7.1 won't support Ubuntu 18.04 anymore, so the last big important distro that did not have a pre-packaged libslirp has been dismissed. All other major distros seem to have a libslirp package in their distribution already - according to repology.org:

            Fedora 34: 4.4.0
    CentOS 8 (RHEL-8): 4.4.0
        Debian Buster: 4.3.1 (in buster-backports) OpenSUSE Leap 15.3: 4.3.1
     Ubuntu LTS 20.04: 4.1.0
        FreeBSD Ports: 4.6.1
        NetBSD pkgsrc: 4.3.1
             Homebrew: 4.6.1
          MSYS2 mingw: 4.6.1

Quoted 8 lines
Quoted 3 lines

The only one that still seems to be missing a libslirp package is OpenBSD - but I assume that they can add it to their ports system quickly if required.

I wish I had seen this earlier as our 7.1 release was just tagged.

I have whipped up a port of 4.6.1 for OpenBSD as it was pretty simple. I will
see about submitting it in a number of days when the tree opens.

How awkward would it be for an end-user who's on OpenBSD 7.1 to build a QEMU that doesn't have libslirp? (That is, is it easy and common for an end user to pull in a port of libslirp that only came along in a later OpenBSD, or would they instead have to manually compile libslirp themselves from the upstream sources?)

Quoted 5 lines

(I'm asking here because if it's painful, then we should perhaps defer dropping our submodule copy of libslirp a little longer.)

thanks
-- PMM

They would have to pull down a -current ports tree and build it. No package would exist for the release. It is possible, but not "supported". I have not looked at the CI bits to see how difficult that would be.

Quoted 6 lines
Quoted 2 lines

Our release cycles are 6 months and the next release will be in the middle of October.

OK, thanks for the update, Brad ... so I guess we should defer this patch to QEMU 7.2 (to be released in december) instead? (which would be fine for me - I just wanted to get the discussion started, that's also why I've marked this patch as RFC)

I would prefer that. My libslirp port will be going in in the next couple days and packages for -current snaps will be built. Our 7.2 release should be out well before the next QEMU release.

#6 lore raw
In reply to Thomas Huth
Quoted 44 lines · Thomas Huth
Quoted 43 lines · Brad Smith
Quoted 31 lines · Peter Maydell
Quoted 16 lines · Brad Smith
Quoted 15 lines · Thomas Huth

QEMU 7.1 won't support Ubuntu 18.04 anymore, so the last big important distro that did not have a pre-packaged libslirp has been dismissed. All other major distros seem to have a libslirp package in their distribution already - according to repology.org:

            Fedora 34: 4.4.0
    CentOS 8 (RHEL-8): 4.4.0
        Debian Buster: 4.3.1 (in buster-backports) OpenSUSE Leap 15.3: 4.3.1
     Ubuntu LTS 20.04: 4.1.0
        FreeBSD Ports: 4.6.1
        NetBSD pkgsrc: 4.3.1
             Homebrew: 4.6.1
          MSYS2 mingw: 4.6.1

Quoted 8 lines
Quoted 3 lines

The only one that still seems to be missing a libslirp package is OpenBSD - but I assume that they can add it to their ports system quickly if required.

I wish I had seen this earlier as our 7.1 release was just tagged.

I have whipped up a port of 4.6.1 for OpenBSD as it was pretty simple. I will
see about submitting it in a number of days when the tree opens.

How awkward would it be for an end-user who's on OpenBSD 7.1 to build a QEMU that doesn't have libslirp? (That is, is it easy and common for an end user to pull in a port of libslirp that only came along in a later OpenBSD, or would they instead have to manually compile libslirp themselves from the upstream sources?)

Quoted 5 lines

(I'm asking here because if it's painful, then we should perhaps defer dropping our submodule copy of libslirp a little longer.)

thanks
-- PMM

They would have to pull down a -current ports tree and build it. No package would exist for the release. It is possible, but not "supported". I have not looked
at the CI bits to see how difficult that would be.

Quoted 7 lines
Quoted 2 lines

Our release cycles are 6 months and the next release will be in the middle of October.

OK, thanks for the update, Brad ... so I guess we should defer this patch to QEMU 7.2 (to be released in december) instead?
(which would be fine for me - I just wanted to get the discussion started, that's also why I've marked this patch as RFC)

Perhaps make 7.1 simply issue a warning message in configure if the bundled slirp is used, to give people a heads up that they'll want to install libslirp-devel soon.

We don't need to follow the formal deprecations process for build deps. Just feels like a nice thing todo if we postpone till 7.2

With regards,
Daniel

Signature · 3 lines
|: 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 :|
#7 lore raw
Quoted 48 lines · Daniel P. Berrangé
Quoted 47 lines · Thomas Huth
Quoted 45 lines · Brad Smith
Quoted 31 lines · Peter Maydell
Quoted 16 lines · Brad Smith
Quoted 15 lines · Thomas Huth

QEMU 7.1 won't support Ubuntu 18.04 anymore, so the last big important distro that did not have a pre-packaged libslirp has been dismissed. All other major distros seem to have a libslirp package in their distribution already - according to repology.org:

            Fedora 34: 4.4.0
    CentOS 8 (RHEL-8): 4.4.0
        Debian Buster: 4.3.1 (in buster-backports) OpenSUSE Leap 15.3: 4.3.1
     Ubuntu LTS 20.04: 4.1.0
        FreeBSD Ports: 4.6.1
        NetBSD pkgsrc: 4.3.1
             Homebrew: 4.6.1
          MSYS2 mingw: 4.6.1

Quoted 8 lines
Quoted 3 lines

The only one that still seems to be missing a libslirp package is OpenBSD - but I assume that they can add it to their ports system quickly if required.

I wish I had seen this earlier as our 7.1 release was just tagged.

I have whipped up a port of 4.6.1 for OpenBSD as it was pretty simple. I will
see about submitting it in a number of days when the tree opens.

How awkward would it be for an end-user who's on OpenBSD 7.1 to build a QEMU that doesn't have libslirp? (That is, is it easy and common for an end user to pull in a port of libslirp that only came along in a later OpenBSD, or would they instead have to manually compile libslirp themselves from the upstream sources?)

Quoted 5 lines

(I'm asking here because if it's painful, then we should perhaps defer dropping our submodule copy of libslirp a little longer.)

thanks
-- PMM

They would have to pull down a -current ports tree and build it. No package would exist for the release. It is possible, but not "supported". I have not looked
at the CI bits to see how difficult that would be.

Our release cycles are 6 months and the next release will be in the middle of October.

Quoted 8 lines
Quoted 4 lines

OK, thanks for the update, Brad ... so I guess we should defer this patch to QEMU 7.2 (to be released in december) instead?
(which would be fine for me - I just wanted to get the discussion started, that's also why I've marked this patch as RFC)

Perhaps make 7.1 simply issue a warning message in configure if the bundled slirp is used, to give people a heads up that they'll want to install libslirp-devel soon.

Not sure if people will notice a warning in the output of "configure" ... but I've put some sentences in the ChangeLog here:

https://wiki.qemu.org/ChangeLog/7.0#New_deprecated_options_and_features

(which we could repeat for the 7.1 release again)

I hope that helps to make people aware...

Thomas

#8 lore raw
Quoted 60 lines · Thomas Huth
Quoted 48 lines · Daniel P. Berrangé
Quoted 47 lines · Thomas Huth
Quoted 45 lines · Brad Smith
Quoted 31 lines · Peter Maydell
Quoted 16 lines · Brad Smith
Quoted 15 lines · Thomas Huth

QEMU 7.1 won't support Ubuntu 18.04 anymore, so the last big important distro that did not have a pre-packaged libslirp has been dismissed. All other major distros seem to have a libslirp package in their distribution already - according to repology.org:

             Fedora 34: 4.4.0
     CentOS 8 (RHEL-8): 4.4.0
         Debian Buster: 4.3.1 (in buster-backports) OpenSUSE Leap 15.3: 4.3.1
      Ubuntu LTS 20.04: 4.1.0
         FreeBSD Ports: 4.6.1
         NetBSD pkgsrc: 4.3.1
              Homebrew: 4.6.1
           MSYS2 mingw: 4.6.1

Quoted 8 lines
Quoted 3 lines

The only one that still seems to be missing a libslirp package is OpenBSD - but I assume that they can add it to their ports system quickly if required.

I wish I had seen this earlier as our 7.1 release was just tagged.

I have whipped up a port of 4.6.1 for OpenBSD as it was pretty simple. I will
see about submitting it in a number of days when the tree opens.

How awkward would it be for an end-user who's on OpenBSD 7.1 to build a QEMU that doesn't have libslirp? (That is, is it easy and common for an end user to pull in a port of libslirp that only came along in a later OpenBSD, or would they instead have to manually compile libslirp themselves from the upstream sources?)

Quoted 5 lines

(I'm asking here because if it's painful, then we should perhaps defer dropping our submodule copy of libslirp a little longer.)

thanks
-- PMM

They would have to pull down a -current ports tree and build it. No package would exist for the release. It is possible, but not "supported". I have not looked
at the CI bits to see how difficult that would be.

Our release cycles are 6 months and the next release will be in the middle of October.

Quoted 8 lines
Quoted 4 lines

OK, thanks for the update, Brad ... so I guess we should defer this patch to QEMU 7.2 (to be released in december) instead?
(which would be fine for me - I just wanted to get the discussion started, that's also why I've marked this patch as RFC)

Perhaps make 7.1 simply issue a warning message in configure if the bundled slirp is used, to give people a heads up that they'll want to install libslirp-devel soon.

Not sure if people will notice a warning in the output of "configure" ... but I've put some sentences in the ChangeLog here:

Quoted 7 lines

https://wiki.qemu.org/ChangeLog/7.0#New_deprecated_options_and_features

(which we could repeat for the 7.1 release again)

I hope that helps to make people aware...

 Thomas

Just to note.. my libslirp port went in.

https://marc.info/?l=openbsd-ports-cvs&m=165070969206193&w=2

and have switched our QEMU port to build with the libslirp port..

https://marc.info/?l=openbsd-ports-cvs&m=165070979906266&w=2

#9 lore raw
In reply to Thomas Huth
Quoted 9 lines · Thomas Huth

The only one that still seems to be missing a libslirp package is OpenBSD - but I assume that they can add it to their ports system quickly if required.

So there is no real urgent need for keeping the slirp submodule in the QEMU tree anymore. Thus let's drop the slirp submodule now and rely on the libslirp packages from the distributions instead.

I would like to have feature parity even with CFI. I had written the libslirp side a few months ago, but never tested it because I didn't get to the QEMU side.

I updated it and you can find it at https://gitlab.freedesktop.org/slirp/libslirp/-/merge_requests/117. I'll get to the QEMU side now.

Paolo

Quoted 390 lines
---
  configure                     |  22 +------
  meson.build                   | 112 +++++-----------------------------
  .gitlab-ci.d/buildtest.yml    |  19 +++---
  .gitmodules                   |   3 -
  MAINTAINERS                   |   1 -
  meson_options.txt             |   5 +-
  scripts/archive-source.sh     |   2 +-
  scripts/meson-buildoptions.sh |   4 +-
  slirp                         |   1 -
  9 files changed, 29 insertions(+), 140 deletions(-)

delete mode 160000 slirp

configure +1 -21
index 7c08c18358..3aedff78a9 100755
@@ -339,10 +339,8 @@ skip_meson=no
  # 1. Track which submodules are needed
  if test "$default_feature" = no ; then
    capstone="disabled"
-  slirp="disabled"
  else
    capstone="auto"
-  slirp="auto"
  fi
  fdt="auto"
 
@@ -874,14 +872,6 @@ for opt do
    ;;
    --disable-tsan) tsan="no"
    ;;
-  --disable-slirp) slirp="disabled"
-  ;;
-  --enable-slirp) slirp="enabled"
-  ;;
-  --enable-slirp=git) slirp="internal"
-  ;;
-  --enable-slirp=*) slirp="$optarg"
-  ;;
    --disable-xen) xen="disabled"
    ;;
    --enable-xen) xen="enabled"
@@ -2576,16 +2566,6 @@ EOF
    fi
  fi
 
-##########################################
-# check for slirp
-
-case "$slirp" in
-  auto | enabled | internal)
-    # Simpler to always update submodule, even if not needed.
-    git_submodules="${git_submodules} slirp"
-    ;;
-esac
-
  ##########################################
  # check for usable __NR_keyctl syscall
 
@@ -3169,7 +3149,7 @@ if test "$skip_meson" = no; then
          -Db_pie=$(if test "$pie" = yes; then echo true; else echo false; fi) \
          -Db_coverage=$(if test "$gcov" = yes; then echo true; else echo false; fi) \
          -Db_lto=$lto -Dcfi=$cfi -Dtcg=$tcg -Dxen=$xen \
-        -Dcapstone=$capstone -Dfdt=$fdt -Dslirp=$slirp \
+        -Dcapstone=$capstone -Dfdt=$fdt \
          $(test -n "${LIB_FUZZING_ENGINE+xxx}" && echo "-Dfuzzing_engine=$LIB_FUZZING_ENGINE") \
          $(if test "$default_feature" = no; then echo "-Dauto_features=disabled"; fi) \
          "$@" $cross_arg "$PWD" "$source_path"
meson.build +16 -96
index 861de93c4f..5d93030da5 100644
@@ -560,6 +560,20 @@ else
                           method: 'pkg-config', kwargs: static_kwargs)
  endif
 
+slirp = not_found
+if not get_option('slirp').auto() or have_system
+  slirp = dependency('slirp', required: get_option('slirp'),
+                     method: 'pkg-config', kwargs: static_kwargs)
+  # We cannot compile QEMU with CFI and libslirp enabled at the same time.
+  # This is because we register slirp functions as callbacks for QEMU Timers.
+  # When using a system-wide shared libslirp, the type information for the
+  # callback is missing and the timer call produces a false positive with CFI.
+  if get_option('cfi')
+    error('Control-Flow Integrity is not compatible with libslirp.' \
+           + ' Please configure with --disable-slirp')
+  endif
+endif
+
  vde = not_found
  if not get_option('vde').auto() or have_system or have_tools
    vde = cc.find_library('vdeplug', has_headers: ['libvdeplug.h'],
@@ -2406,100 +2420,6 @@ if capstone_opt == 'internal'
                                  include_directories: 'capstone/include/capstone')
  endif
 
-slirp = not_found
-slirp_opt = 'disabled'
-if have_system
-  slirp_opt = get_option('slirp')
-  if slirp_opt in ['enabled', 'auto', 'system']
-    have_internal = fs.exists(meson.current_source_dir() / 'slirp/meson.build')
-    slirp = dependency('slirp', kwargs: static_kwargs,
-                       method: 'pkg-config',
-                       required: slirp_opt == 'system' or
-                                 slirp_opt == 'enabled' and not have_internal)
-    if slirp.found()
-      slirp_opt = 'system'
-    elif have_internal
-      slirp_opt = 'internal'
-    else
-      slirp_opt = 'disabled'
-    endif
-  endif
-  if slirp_opt == 'internal'
-    slirp_deps = []
-    if targetos == 'windows'
-      slirp_deps = cc.find_library('iphlpapi')
-    elif targetos == 'darwin'
-      slirp_deps = cc.find_library('resolv')
-    endif
-    slirp_conf = configuration_data()
-    slirp_conf.set('SLIRP_MAJOR_VERSION', meson.project_version().split('.')[0])
-    slirp_conf.set('SLIRP_MINOR_VERSION', meson.project_version().split('.')[1])
-    slirp_conf.set('SLIRP_MICRO_VERSION', meson.project_version().split('.')[2])
-    slirp_conf.set_quoted('SLIRP_VERSION_STRING', meson.project_version())
-    slirp_cargs = ['-DG_LOG_DOMAIN="Slirp"']
-    slirp_files = [
-      'slirp/src/arp_table.c',
-      'slirp/src/bootp.c',
-      'slirp/src/cksum.c',
-      'slirp/src/dhcpv6.c',
-      'slirp/src/dnssearch.c',
-      'slirp/src/if.c',
-      'slirp/src/ip6_icmp.c',
-      'slirp/src/ip6_input.c',
-      'slirp/src/ip6_output.c',
-      'slirp/src/ip_icmp.c',
-      'slirp/src/ip_input.c',
-      'slirp/src/ip_output.c',
-      'slirp/src/mbuf.c',
-      'slirp/src/misc.c',
-      'slirp/src/ncsi.c',
-      'slirp/src/ndp_table.c',
-      'slirp/src/sbuf.c',
-      'slirp/src/slirp.c',
-      'slirp/src/socket.c',
-      'slirp/src/state.c',
-      'slirp/src/stream.c',
-      'slirp/src/tcp_input.c',
-      'slirp/src/tcp_output.c',
-      'slirp/src/tcp_subr.c',
-      'slirp/src/tcp_timer.c',
-      'slirp/src/tftp.c',
-      'slirp/src/udp.c',
-      'slirp/src/udp6.c',
-      'slirp/src/util.c',
-      'slirp/src/version.c',
-      'slirp/src/vmstate.c',
-    ]
-
-    configure_file(
-      input : 'slirp/src/libslirp-version.h.in',
-      output : 'libslirp-version.h',
-      configuration: slirp_conf)
-
-    slirp_inc = include_directories('slirp', 'slirp/src')
-    libslirp = static_library('slirp',
-                              build_by_default: false,
-                              sources: slirp_files,
-                              c_args: slirp_cargs,
-                              include_directories: slirp_inc)
-    slirp = declare_dependency(link_with: libslirp,
-                               dependencies: slirp_deps,
-                               include_directories: slirp_inc)
-  endif
-endif
-
-# For CFI, we need to compile slirp as a static library together with qemu.
-# This is because we register slirp functions as callbacks for QEMU Timers.
-# When using a system-wide shared libslirp, the type information for the
-# callback is missing and the timer call produces a false positive with CFI.
-#
-# Now that slirp_opt has been defined, check if the selected slirp is compatible
-# with control-flow integrity.
-if get_option('cfi') and slirp_opt == 'system'
-  error('Control-Flow Integrity is not compatible with system-wide slirp.' \
-         + ' Please configure with --enable-slirp=git')
-endif
-
  fdt = not_found
  if have_system
    fdt_opt = get_option('fdt')
@@ -3471,7 +3391,7 @@ summary_info += {'genisoimage':       config_host['GENISOIMAGE']}
  if targetos == 'windows' and have_ga
    summary_info += {'wixl':            wixl}
  endif
-if slirp_opt != 'disabled' and have_system
+if slirp.found() and have_system
    summary_info += {'smbd':            have_slirp_smbd ? smbd_path : false}
  endif
  summary(summary_info, bool_yn: true, section: 'Host binaries')
@@ -3666,7 +3586,7 @@ summary_info += {'SDL image support': sdl_image}
  summary_info += {'GTK support':       gtk}
  summary_info += {'pixman':            pixman}
  summary_info += {'VTE support':       vte}
-summary_info += {'slirp support':     slirp_opt == 'internal' ? slirp_opt : slirp}
+summary_info += {'slirp support':     slirp}
  summary_info += {'libtasn1':          tasn1}
  summary_info += {'PAM':               pam}
  summary_info += {'iconv support':     iconv}
.gitlab-ci.d/buildtest.yml +8 -11
index 0aea7ab84c..19dc9f4590 100644
@@ -41,7 +41,7 @@ build-system-ubuntu:
      job: amd64-ubuntu2004-container
    variables:
      IMAGE: ubuntu2004
-    CONFIGURE_ARGS: --enable-docs --enable-fdt=system --enable-slirp=system
+    CONFIGURE_ARGS: --enable-docs --enable-fdt=system
      TARGETS: aarch64-softmmu alpha-softmmu cris-softmmu hppa-softmmu
        microblazeel-softmmu mips64el-softmmu
      MAKE_CHECK_ARGS: check-build
@@ -118,7 +118,7 @@ build-system-fedora:
    variables:
      IMAGE: fedora
      CONFIGURE_ARGS: --disable-gcrypt --enable-nettle --enable-docs
-             --enable-fdt=system --enable-slirp=system --enable-capstone=system
+             --enable-fdt=system --enable-capstone=system
      TARGETS: tricore-softmmu microblaze-softmmu mips-softmmu
        xtensa-softmmu m68k-softmmu riscv32-softmmu ppc-softmmu sparc64-softmmu
      MAKE_CHECK_ARGS: check-build
@@ -335,10 +335,8 @@ clang-user:
  # On gitlab runners, default value sometimes end up calling 2 lds concurrently and
  # triggers an Out-Of-Memory error
  #
-# Since slirp callbacks are used in QEMU Timers, slirp needs to be compiled together
-# with QEMU and linked as a static library to avoid false positives in CFI checks.
-# This can be accomplished by using -enable-slirp=git, which avoids the use of
-# a system-wide version of the library
+# Since slirp callbacks are used in QEMU Timers, we cannot use libslirp with
+# CFI builds, and thus have to disable it here.
  #
  # Split in three sets of build/check/avocado to limit the execution time of each
  # job
@@ -351,7 +349,7 @@ build-cfi-aarch64:
      AR: llvm-ar
      IMAGE: fedora
      CONFIGURE_ARGS: --cc=clang --cxx=clang++ --enable-cfi --enable-cfi-debug
-      --enable-safe-stack --enable-slirp=git
+      --enable-safe-stack --disable-slirp
      TARGETS: aarch64-softmmu
      MAKE_CHECK_ARGS: check-build
    timeout: 70m
@@ -393,7 +391,7 @@ build-cfi-ppc64-s390x:
      AR: llvm-ar
      IMAGE: fedora
      CONFIGURE_ARGS: --cc=clang --cxx=clang++ --enable-cfi --enable-cfi-debug
-      --enable-safe-stack --enable-slirp=git
+      --enable-safe-stack --disable-slirp
      TARGETS: ppc64-softmmu s390x-softmmu
      MAKE_CHECK_ARGS: check-build
    timeout: 70m
@@ -435,7 +433,7 @@ build-cfi-x86_64:
      AR: llvm-ar
      IMAGE: fedora
      CONFIGURE_ARGS: --cc=clang --cxx=clang++ --enable-cfi --enable-cfi-debug
-      --enable-safe-stack --enable-slirp=git
+      --enable-safe-stack --disable-slirp
      TARGETS: x86_64-softmmu
      MAKE_CHECK_ARGS: check-build
    timeout: 70m
@@ -469,7 +467,7 @@ tsan-build:
    variables:
      IMAGE: ubuntu2004
      CONFIGURE_ARGS: --enable-tsan --cc=clang-10 --cxx=clang++-10
-          --enable-trace-backends=ust --enable-fdt=system --enable-slirp=system
+          --enable-trace-backends=ust --enable-fdt=system --disable-slirp
      TARGETS: x86_64-softmmu ppc64-softmmu riscv64-softmmu x86_64-linux-user
      MAKE_CHECK_ARGS: bench V=1
 
@@ -571,7 +569,6 @@ build-without-default-features:
        --disable-capstone
        --disable-pie
        --disable-qom-cast-debug
-      --disable-slirp
        --disable-strip
      TARGETS: avr-softmmu i386-softmmu mips64-softmmu s390x-softmmu sh4-softmmu
        sparc64-softmmu hexagon-linux-user i386-linux-user s390x-linux-user
.gitmodules +0 -3
index f4b6a9b401..d55cdb5036 100644
@@ -49,9 +49,6 @@
  [submodule "roms/edk2"]
  	path = roms/edk2
  	url = https://gitlab.com/qemu-project/edk2.git
-[submodule "slirp"]
-	path = slirp
-	url = https://gitlab.com/qemu-project/libslirp.git
  [submodule "roms/opensbi"]
  	path = roms/opensbi
  	url = 	https://gitlab.com/qemu-project/opensbi.git
MAINTAINERS +0 -1
index 4ad2451e03..9a4fa68cc0 100644
@@ -2924,7 +2924,6 @@ F: include/hw/registerfields.h
  SLIRP
  M: Samuel Thibault <[email protected]>
  S: Maintained
-F: slirp/
  F: net/slirp.c
  F: include/net/slirp.h
  T: git https://people.debian.org/~sthibault/qemu.git slirp
meson_options.txt +2 -3
index 52b11cead4..668c859d84 100644
@@ -173,6 +173,8 @@ option('l2tpv3', type : 'feature', value : 'auto',
         description: 'l2tpv3 network backend support')
  option('netmap', type : 'feature', value : 'auto',
         description: 'netmap network backend support')
+option('slirp', type: 'feature', value: 'auto',
+       description: 'libslirp user mode network backend support')
  option('vde', type : 'feature', value : 'auto',
         description: 'vde network backend support')
  option('virglrenderer', type : 'feature', value : 'auto',
@@ -223,9 +225,6 @@ option('virtiofsd', type: 'feature', value: 'auto',
  option('capstone', type: 'combo', value: 'auto',
         choices: ['disabled', 'enabled', 'auto', 'system', 'internal'],
         description: 'Whether and how to find the capstone library')
-option('slirp', type: 'combo', value: 'auto',
-       choices: ['disabled', 'enabled', 'auto', 'system', 'internal'],
-       description: 'Whether and how to find the slirp library')
  option('fdt', type: 'combo', value: 'auto',
         choices: ['disabled', 'enabled', 'auto', 'system', 'internal'],
         description: 'Whether and how to find the libfdt library')
scripts/archive-source.sh +1 -1
index c6169db69f..23e042dacd 100755
@@ -26,7 +26,7 @@ sub_file="${sub_tdir}/submodule.tar"
  # independent of what the developer currently has initialized
  # in their checkout, because the build environment is completely
  # different to the host OS.
-submodules="dtc slirp meson ui/keycodemapdb"
+submodules="dtc meson ui/keycodemapdb"
  submodules="$submodules tests/fp/berkeley-softfloat-3 tests/fp/berkeley-testfloat-3"
  sub_deinit=""
 
scripts/meson-buildoptions.sh +1 -3
index 1e26f4571e..dcfecb69ad 100644
@@ -23,8 +23,6 @@ meson_options_help() {
    printf "%s\n" '  --enable-qom-cast-debug  cast debugging support'
    printf "%s\n" '  --enable-rng-none        dummy RNG, avoid using /dev/(u)random and'
    printf "%s\n" '                           getrandom()'
-  printf "%s\n" '  --enable-slirp[=CHOICE]  Whether and how to find the slirp library'
-  printf "%s\n" '                           (choices: auto/disabled/enabled/internal/system)'
    printf "%s\n" '  --enable-strip           Strip targets on install'
    printf "%s\n" '  --enable-tcg-interpreter TCG with bytecode interpreter (slow)'
    printf "%s\n" '  --enable-trace-backends=CHOICE'
@@ -103,6 +101,7 @@ meson_options_help() {
    printf "%s\n" '  sdl-image       SDL Image support for icons'
    printf "%s\n" '  seccomp         seccomp support'
    printf "%s\n" '  selinux         SELinux support in qemu-nbd'
+  printf "%s\n" '  slirp           libslirp user mode network backend support'
    printf "%s\n" '  slirp-smbd      use smbd (at path --smbd=*) in slirp networking'
    printf "%s\n" '  smartcard       CA smartcard emulation support'
    printf "%s\n" '  snappy          snappy compression support'
@@ -303,7 +302,6 @@ _meson_option_parse() {
      --disable-selinux) printf "%s" -Dselinux=disabled ;;
      --enable-slirp) printf "%s" -Dslirp=enabled ;;
      --disable-slirp) printf "%s" -Dslirp=disabled ;;
-    --enable-slirp=*) quote_sh "-Dslirp=$2" ;;
      --enable-slirp-smbd) printf "%s" -Dslirp_smbd=enabled ;;
      --disable-slirp-smbd) printf "%s" -Dslirp_smbd=disabled ;;
      --enable-smartcard) printf "%s" -Dsmartcard=enabled ;;
slirp deleted +0 -1
deleted file mode 160000
index a88d9ace23..0000000000
@@ -1 +0,0 @@
-Subproject commit a88d9ace234a24ce1c17189642ef9104799425e0
#10 lore raw
Quoted 9 lines · Paolo Bonzini
Quoted 8 lines · Thomas Huth

The only one that still seems to be missing a libslirp package is OpenBSD - but I assume that they can add it to their ports system quickly if required.

So there is no real urgent need for keeping the slirp submodule in the QEMU tree anymore. Thus let's drop the slirp submodule now and rely on the libslirp packages from the distributions instead.

Quoted 5 lines
Quoted 1 line

I would like to have feature parity even with CFI.  I had written the libslirp side a few months ago, but never tested it because I didn't get to the QEMU side.

I updated it and you can find it at https://gitlab.freedesktop.org/slirp/libslirp/-/merge_requests/117. I'll get to the QEMU side now.

Also, doing this at the same time as a switch to Meson >=0.60 (probably 0.61.x) would allow something like

option('slirp', type: 'feature', value: 'auto',
description: 'libslirp user mode network backend support',
deprecated: {'system': 'enabled', 'internal': 'auto'})

This keeps incremental builds working. All of this should be doable in 7.1, so this is not an objection to removing the submodule in 7.1.

Paolo