Skip to content

Commit 5890258

Browse files
committed
Remove the slirp submodule (i.e. compile only with an external libslirp)
Since QEMU 7.1 we don't support Ubuntu 18.04 anymore, so the last big important Linux 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 35: 4.6.1 CentOS 8 (RHEL-8): 4.4.0 Debian 11: 4.4.0 OpenSUSE Leap 15.3: 4.3.1 Ubuntu LTS 20.04: 4.1.0 FreeBSD Ports: 4.7.0 NetBSD pkgsrc: 4.7.0 Homebrew: 4.7.0 MSYS2 mingw: 4.7.0 The only one that was still missing a libslirp package is OpenBSD - but the next version (OpenBSD 7.2 which will be shipped in October) is going to include a libslirp package. Since QEMU 7.2 will be published after OpenBSD 7.2, we should be fine there, too. 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. Message-Id: <[email protected]> Acked-by: Samuel Thibault <[email protected]> Signed-off-by: Thomas Huth <[email protected]>
1 parent 59d1ce4 commit 5890258

9 files changed

+34
-147
lines changed

.gitlab-ci.d/buildtest.yml

+8-12
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ build-system-ubuntu:
4141
job: amd64-ubuntu2004-container
4242
variables:
4343
IMAGE: ubuntu2004
44-
CONFIGURE_ARGS: --enable-docs --enable-fdt=system --enable-slirp=system
45-
--enable-capstone
44+
CONFIGURE_ARGS: --enable-docs --enable-fdt=system --enable-capstone
4645
TARGETS: aarch64-softmmu alpha-softmmu cris-softmmu hppa-softmmu
4746
microblazeel-softmmu mips64el-softmmu
4847
MAKE_CHECK_ARGS: check-build
@@ -120,7 +119,7 @@ build-system-fedora:
120119
variables:
121120
IMAGE: fedora
122121
CONFIGURE_ARGS: --disable-gcrypt --enable-nettle --enable-docs
123-
--enable-fdt=system --enable-slirp=system --enable-capstone
122+
--enable-fdt=system --enable-slirp --enable-capstone
124123
TARGETS: tricore-softmmu microblaze-softmmu mips-softmmu
125124
xtensa-softmmu m68k-softmmu riscv32-softmmu ppc-softmmu sparc64-softmmu
126125
MAKE_CHECK_ARGS: check-build
@@ -339,10 +338,8 @@ clang-user:
339338
# On gitlab runners, default value sometimes end up calling 2 lds concurrently and
340339
# triggers an Out-Of-Memory error
341340
#
342-
# Since slirp callbacks are used in QEMU Timers, slirp needs to be compiled together
343-
# with QEMU and linked as a static library to avoid false positives in CFI checks.
344-
# This can be accomplished by using -enable-slirp=git, which avoids the use of
345-
# a system-wide version of the library
341+
# Since slirp callbacks are used in QEMU Timers, we cannot use libslirp with
342+
# CFI builds, and thus have to disable it here.
346343
#
347344
# Split in three sets of build/check/avocado to limit the execution time of each
348345
# job
@@ -355,7 +352,7 @@ build-cfi-aarch64:
355352
AR: llvm-ar
356353
IMAGE: fedora
357354
CONFIGURE_ARGS: --cc=clang --cxx=clang++ --enable-cfi --enable-cfi-debug
358-
--enable-safe-stack --enable-slirp=git
355+
--enable-safe-stack --disable-slirp
359356
TARGETS: aarch64-softmmu
360357
MAKE_CHECK_ARGS: check-build
361358
# FIXME: This job is often failing, likely due to out-of-memory problems in
@@ -395,7 +392,7 @@ build-cfi-ppc64-s390x:
395392
AR: llvm-ar
396393
IMAGE: fedora
397394
CONFIGURE_ARGS: --cc=clang --cxx=clang++ --enable-cfi --enable-cfi-debug
398-
--enable-safe-stack --enable-slirp=git
395+
--enable-safe-stack --disable-slirp
399396
TARGETS: ppc64-softmmu s390x-softmmu
400397
MAKE_CHECK_ARGS: check-build
401398
# FIXME: This job is often failing, likely due to out-of-memory problems in
@@ -435,7 +432,7 @@ build-cfi-x86_64:
435432
AR: llvm-ar
436433
IMAGE: fedora
437434
CONFIGURE_ARGS: --cc=clang --cxx=clang++ --enable-cfi --enable-cfi-debug
438-
--enable-safe-stack --enable-slirp=git
435+
--enable-safe-stack --disable-slirp
439436
TARGETS: x86_64-softmmu
440437
MAKE_CHECK_ARGS: check-build
441438
timeout: 70m
@@ -469,7 +466,7 @@ tsan-build:
469466
variables:
470467
IMAGE: ubuntu2004
471468
CONFIGURE_ARGS: --enable-tsan --cc=clang-10 --cxx=clang++-10
472-
--enable-trace-backends=ust --enable-fdt=system --enable-slirp=system
469+
--enable-trace-backends=ust --enable-fdt=system --disable-slirp
473470
TARGETS: x86_64-softmmu ppc64-softmmu riscv64-softmmu x86_64-linux-user
474471
MAKE_CHECK_ARGS: bench V=1
475472

@@ -571,7 +568,6 @@ build-without-default-features:
571568
--disable-capstone
572569
--disable-pie
573570
--disable-qom-cast-debug
574-
--disable-slirp
575571
--disable-strip
576572
TARGETS: avr-softmmu i386-softmmu mips64-softmmu s390x-softmmu sh4-softmmu
577573
sparc64-softmmu hexagon-linux-user i386-linux-user s390x-linux-user

.gitmodules

-3
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@
4646
[submodule "roms/edk2"]
4747
path = roms/edk2
4848
url = https://gitlab.com/qemu-project/edk2.git
49-
[submodule "slirp"]
50-
path = slirp
51-
url = https://gitlab.com/qemu-project/libslirp.git
5249
[submodule "roms/opensbi"]
5350
path = roms/opensbi
5451
url = https://gitlab.com/qemu-project/opensbi.git

MAINTAINERS

-1
Original file line numberDiff line numberDiff line change
@@ -2978,7 +2978,6 @@ F: include/hw/registerfields.h
29782978
SLIRP
29792979
M: Samuel Thibault <[email protected]>
29802980
S: Maintained
2981-
F: slirp/
29822981
F: net/slirp.c
29832982
F: include/net/slirp.h
29842983
T: git https://people.debian.org/~sthibault/qemu.git slirp

configure

-24
Original file line numberDiff line numberDiff line change
@@ -321,11 +321,6 @@ vfio_user_server="disabled"
321321
# are included in the automatically generated help message)
322322

323323
# 1. Track which submodules are needed
324-
if test "$default_feature" = no ; then
325-
slirp="disabled"
326-
else
327-
slirp="auto"
328-
fi
329324
fdt="auto"
330325

331326
# 2. Automatically enable/disable other options
@@ -829,14 +824,6 @@ for opt do
829824
;;
830825
--disable-tsan) tsan="no"
831826
;;
832-
--disable-slirp) slirp="disabled"
833-
;;
834-
--enable-slirp) slirp="enabled"
835-
;;
836-
--enable-slirp=git) slirp="internal"
837-
;;
838-
--enable-slirp=*) slirp="$optarg"
839-
;;
840827
--disable-tcg) tcg="disabled"
841828
plugins="no"
842829
;;
@@ -1823,16 +1810,6 @@ EOF
18231810
fi
18241811
fi
18251812

1826-
##########################################
1827-
# check for slirp
1828-
1829-
case "$slirp" in
1830-
auto | enabled | internal)
1831-
# Simpler to always update submodule, even if not needed.
1832-
git_submodules="${git_submodules} slirp"
1833-
;;
1834-
esac
1835-
18361813
##########################################
18371814
# functions to probe cross compilers
18381815

@@ -2741,7 +2718,6 @@ if test "$skip_meson" = no; then
27412718
test "$fdt" != auto && meson_option_add "-Dfdt=$fdt"
27422719
test -n "${LIB_FUZZING_ENGINE+xxx}" && meson_option_add "-Dfuzzing_engine=$LIB_FUZZING_ENGINE"
27432720
test "$qemu_suffix" != qemu && meson_option_add "-Dqemu_suffix=$qemu_suffix"
2744-
test "$slirp" != auto && meson_option_add "-Dslirp=$slirp"
27452721
test "$smbd" != '' && meson_option_add "-Dsmbd=$smbd"
27462722
test "$tcg" != enabled && meson_option_add "-Dtcg=$tcg"
27472723
test "$vfio_user_server" != auto && meson_option_add "-Dvfio_user_server=$vfio_user_server"

meson.build

+22-99
Original file line numberDiff line numberDiff line change
@@ -643,6 +643,26 @@ else
643643
method: 'pkg-config', kwargs: static_kwargs)
644644
endif
645645

646+
slirp = not_found
647+
if not get_option('slirp').auto() or have_system
648+
slirp = dependency('slirp', required: get_option('slirp'),
649+
method: 'pkg-config', kwargs: static_kwargs)
650+
# slirp < 4.7 is incompatible with CFI support in QEMU. This is because
651+
# it passes function pointers within libslirp as callbacks for timers.
652+
# When using a system-wide shared libslirp, the type information for the
653+
# callback is missing and the timer call produces a false positive with CFI.
654+
# Do not use the "version" keyword argument to produce a better error.
655+
# with control-flow integrity.
656+
if get_option('cfi') and slirp.found() and slirp.version().version_compare('<4.7')
657+
if get_option('slirp').enabled()
658+
error('Control-Flow Integrity requires libslirp 4.7.')
659+
else
660+
warning('Cannot use libslirp since Control-Flow Integrity requires libslirp >= 4.7.')
661+
slirp = not_found
662+
endif
663+
endif
664+
endif
665+
646666
vde = not_found
647667
if not get_option('vde').auto() or have_system or have_tools
648668
vde = cc.find_library('vdeplug', has_headers: ['libvdeplug.h'],
@@ -2617,103 +2637,6 @@ if not get_option('capstone').auto() or have_system or have_user
26172637
endif
26182638
endif
26192639

2620-
slirp = not_found
2621-
slirp_opt = 'disabled'
2622-
if have_system
2623-
slirp_opt = get_option('slirp')
2624-
if slirp_opt in ['enabled', 'auto', 'system']
2625-
have_internal = fs.exists(meson.current_source_dir() / 'slirp/meson.build')
2626-
slirp_dep_required = (slirp_opt == 'system' or
2627-
slirp_opt == 'enabled' and not have_internal)
2628-
slirp = dependency('slirp', kwargs: static_kwargs,
2629-
method: 'pkg-config', version: '>=4.1.0',
2630-
required: slirp_dep_required)
2631-
# slirp <4.7 is incompatible with CFI support in QEMU. This is because
2632-
# it passes function pointers within libslirp as callbacks for timers.
2633-
# When using a system-wide shared libslirp, the type information for the
2634-
# callback is missing and the timer call produces a false positive with CFI.
2635-
# Do not use the "version" keyword argument to produce a better error.
2636-
# with control-flow integrity.
2637-
if get_option('cfi') and slirp.found() and slirp.version().version_compare('<4.7')
2638-
if slirp_dep_required
2639-
error('Control-Flow Integrity requires libslirp 4.7.')
2640-
else
2641-
warning('Control-Flow Integrity requires libslirp 4.7, not using system-wide libslirp.')
2642-
slirp = not_found
2643-
endif
2644-
endif
2645-
if slirp.found()
2646-
slirp_opt = 'system'
2647-
elif have_internal
2648-
slirp_opt = 'internal'
2649-
else
2650-
slirp_opt = 'disabled'
2651-
endif
2652-
endif
2653-
if slirp_opt == 'internal'
2654-
slirp_deps = []
2655-
if targetos == 'windows'
2656-
slirp_deps = cc.find_library('iphlpapi')
2657-
elif targetos == 'darwin'
2658-
slirp_deps = cc.find_library('resolv')
2659-
endif
2660-
slirp_conf = configuration_data()
2661-
slirp_conf.set('SLIRP_MAJOR_VERSION', meson.project_version().split('.')[0])
2662-
slirp_conf.set('SLIRP_MINOR_VERSION', meson.project_version().split('.')[1])
2663-
slirp_conf.set('SLIRP_MICRO_VERSION', meson.project_version().split('.')[2])
2664-
slirp_conf.set_quoted('SLIRP_VERSION_STRING', meson.project_version())
2665-
slirp_cargs = ['-DG_LOG_DOMAIN="Slirp"']
2666-
slirp_files = [
2667-
'slirp/src/arp_table.c',
2668-
'slirp/src/bootp.c',
2669-
'slirp/src/cksum.c',
2670-
'slirp/src/dhcpv6.c',
2671-
'slirp/src/dnssearch.c',
2672-
'slirp/src/if.c',
2673-
'slirp/src/ip6_icmp.c',
2674-
'slirp/src/ip6_input.c',
2675-
'slirp/src/ip6_output.c',
2676-
'slirp/src/ip_icmp.c',
2677-
'slirp/src/ip_input.c',
2678-
'slirp/src/ip_output.c',
2679-
'slirp/src/mbuf.c',
2680-
'slirp/src/misc.c',
2681-
'slirp/src/ncsi.c',
2682-
'slirp/src/ndp_table.c',
2683-
'slirp/src/sbuf.c',
2684-
'slirp/src/slirp.c',
2685-
'slirp/src/socket.c',
2686-
'slirp/src/state.c',
2687-
'slirp/src/stream.c',
2688-
'slirp/src/tcp_input.c',
2689-
'slirp/src/tcp_output.c',
2690-
'slirp/src/tcp_subr.c',
2691-
'slirp/src/tcp_timer.c',
2692-
'slirp/src/tftp.c',
2693-
'slirp/src/udp.c',
2694-
'slirp/src/udp6.c',
2695-
'slirp/src/util.c',
2696-
'slirp/src/version.c',
2697-
'slirp/src/vmstate.c',
2698-
]
2699-
2700-
configure_file(
2701-
input : 'slirp/src/libslirp-version.h.in',
2702-
output : 'libslirp-version.h',
2703-
configuration: slirp_conf)
2704-
2705-
slirp_inc = include_directories('slirp', 'slirp/src')
2706-
libslirp = static_library('slirp',
2707-
build_by_default: false,
2708-
sources: slirp_files,
2709-
c_args: slirp_cargs,
2710-
include_directories: slirp_inc)
2711-
slirp = declare_dependency(link_with: libslirp,
2712-
dependencies: slirp_deps,
2713-
include_directories: slirp_inc)
2714-
endif
2715-
endif
2716-
27172640
libvfio_user_dep = not_found
27182641
if have_system and vfio_user_server_allowed
27192642
have_internal = fs.exists(meson.current_source_dir() / 'subprojects/libvfio-user/meson.build')
@@ -3718,7 +3641,7 @@ summary_info += {'genisoimage': config_host['GENISOIMAGE']}
37183641
if targetos == 'windows' and have_ga
37193642
summary_info += {'wixl': wixl}
37203643
endif
3721-
if slirp_opt != 'disabled' and have_system
3644+
if slirp.found() and have_system
37223645
summary_info += {'smbd': have_slirp_smbd ? smbd_path : false}
37233646
endif
37243647
summary(summary_info, bool_yn: true, section: 'Host binaries')
@@ -3912,7 +3835,7 @@ summary_info += {'SDL image support': sdl_image}
39123835
summary_info += {'GTK support': gtk}
39133836
summary_info += {'pixman': pixman}
39143837
summary_info += {'VTE support': vte}
3915-
summary_info += {'slirp support': slirp_opt == 'internal' ? slirp_opt : slirp}
3838+
summary_info += {'slirp support': slirp}
39163839
summary_info += {'libtasn1': tasn1}
39173840
summary_info += {'PAM': pam}
39183841
summary_info += {'iconv support': iconv}

meson_options.txt

+2-3
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,8 @@ option('l2tpv3', type : 'feature', value : 'auto',
199199
description: 'l2tpv3 network backend support')
200200
option('netmap', type : 'feature', value : 'auto',
201201
description: 'netmap network backend support')
202+
option('slirp', type: 'feature', value: 'auto',
203+
description: 'libslirp user mode network backend support')
202204
option('vde', type : 'feature', value : 'auto',
203205
description: 'vde network backend support')
204206
option('vmnet', type : 'feature', value : 'auto',
@@ -264,9 +266,6 @@ option('vduse_blk_export', type: 'feature', value: 'auto',
264266

265267
option('capstone', type: 'feature', value: 'auto',
266268
description: 'Whether and how to find the capstone library')
267-
option('slirp', type: 'combo', value: 'auto',
268-
choices: ['disabled', 'enabled', 'auto', 'system', 'internal'],
269-
description: 'Whether and how to find the slirp library')
270269
option('fdt', type: 'combo', value: 'auto',
271270
choices: ['disabled', 'enabled', 'auto', 'system', 'internal'],
272271
description: 'Whether and how to find the libfdt library')

scripts/archive-source.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ sub_file="${sub_tdir}/submodule.tar"
2626
# independent of what the developer currently has initialized
2727
# in their checkout, because the build environment is completely
2828
# different to the host OS.
29-
submodules="dtc slirp meson ui/keycodemapdb"
29+
submodules="dtc meson ui/keycodemapdb"
3030
submodules="$submodules tests/fp/berkeley-softfloat-3 tests/fp/berkeley-testfloat-3"
3131
sub_deinit=""
3232

scripts/meson-buildoptions.sh

+1-3
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ meson_options_help() {
3535
printf "%s\n" ' --enable-qom-cast-debug cast debugging support'
3636
printf "%s\n" ' --enable-rng-none dummy RNG, avoid using /dev/(u)random and'
3737
printf "%s\n" ' getrandom()'
38-
printf "%s\n" ' --enable-slirp[=CHOICE] Whether and how to find the slirp library'
39-
printf "%s\n" ' (choices: auto/disabled/enabled/internal/system)'
4038
printf "%s\n" ' --enable-strip Strip targets on install'
4139
printf "%s\n" ' --enable-tcg-interpreter TCG with bytecode interpreter (slow)'
4240
printf "%s\n" ' --enable-trace-backends=CHOICES'
@@ -141,6 +139,7 @@ meson_options_help() {
141139
printf "%s\n" ' sdl-image SDL Image support for icons'
142140
printf "%s\n" ' seccomp seccomp support'
143141
printf "%s\n" ' selinux SELinux support in qemu-nbd'
142+
printf "%s\n" ' slirp libslirp user mode network backend support'
144143
printf "%s\n" ' slirp-smbd use smbd (at path --smbd=*) in slirp networking'
145144
printf "%s\n" ' smartcard CA smartcard emulation support'
146145
printf "%s\n" ' snappy snappy compression support'
@@ -386,7 +385,6 @@ _meson_option_parse() {
386385
--disable-selinux) printf "%s" -Dselinux=disabled ;;
387386
--enable-slirp) printf "%s" -Dslirp=enabled ;;
388387
--disable-slirp) printf "%s" -Dslirp=disabled ;;
389-
--enable-slirp=*) quote_sh "-Dslirp=$2" ;;
390388
--enable-slirp-smbd) printf "%s" -Dslirp_smbd=enabled ;;
391389
--disable-slirp-smbd) printf "%s" -Dslirp_smbd=disabled ;;
392390
--enable-smartcard) printf "%s" -Dsmartcard=enabled ;;

slirp

-1
This file was deleted.

0 commit comments

Comments
 (0)