[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 20/27] net: slirp: allow CFI with libslirp >= 4.7
From: |
Paolo Bonzini |
Subject: |
[PULL 20/27] net: slirp: allow CFI with libslirp >= 4.7 |
Date: |
Thu, 12 May 2022 19:24:58 +0200 |
slirp 4.7 introduces a new CFI-friendly timer callback that does
not pass function pointers within libslirp as callbacks for timers.
Check the version number and, if it is new enough, allow using CFI
even with a system libslirp.
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Reviewed-by: Marc-André Lureau <malureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
meson.build | 31 +++++++++++++++++--------------
1 file changed, 17 insertions(+), 14 deletions(-)
diff --git a/meson.build b/meson.build
index ea72ba7c2f..9b20dcd143 100644
--- a/meson.build
+++ b/meson.build
@@ -2637,10 +2637,25 @@ 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_dep_required = (slirp_opt == 'system' or
+ slirp_opt == 'enabled' and not have_internal)
slirp = dependency('slirp', kwargs: static_kwargs,
method: 'pkg-config', version: '>=4.1.0',
- required: slirp_opt == 'system' or
- slirp_opt == 'enabled' and not have_internal)
+ required: slirp_dep_required)
+ # slirp <4.7 is incompatible with CFI support in QEMU. This is because
+ # it passes function pointers within libslirp as callbacks for 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.
+ # Do not use the "version" keyword argument to produce a better error.
+ # with control-flow integrity.
+ if get_option('cfi') and slirp.found() and
slirp.version().version_compare('<4.7')
+ if slirp_dep_required
+ error('Control-Flow Integrity requires libslirp 4.7.')
+ else
+ warning('Control-Flow Integrity requires libslirp 4.7, not using
system-wide libslirp.')
+ slirp = not_found
+ endif
+ endif
if slirp.found()
slirp_opt = 'system'
elif have_internal
@@ -2713,18 +2728,6 @@ if have_system
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')
--
2.36.0
- [PULL 03/27] target/i386: do not consult nonexistent host leaves, (continued)
- [PULL 03/27] target/i386: do not consult nonexistent host leaves, Paolo Bonzini, 2022/05/12
- [PULL 01/27] pc-bios/optionrom: detect -fno-pie, Paolo Bonzini, 2022/05/12
- [PULL 05/27] meson: Make mremap() detecting works correctly, Paolo Bonzini, 2022/05/12
- [PULL 11/27] machine: use QAPI struct for boot configuration, Paolo Bonzini, 2022/05/12
- [PULL 12/27] machine: add boot compound property, Paolo Bonzini, 2022/05/12
- [PULL 16/27] slirp: bump submodule past 4.7 release, Paolo Bonzini, 2022/05/12
- [PULL 06/27] hw/xen/xen_pt: Confine igd-passthrough-isa-bridge to XEN, Paolo Bonzini, 2022/05/12
- [PULL 14/27] machine: make memory-backend a link property, Paolo Bonzini, 2022/05/12
- [PULL 17/27] net: slirp: introduce a wrapper struct for QemuTimer, Paolo Bonzini, 2022/05/12
- [PULL 18/27] net: slirp: switch to slirp_new, Paolo Bonzini, 2022/05/12
- [PULL 20/27] net: slirp: allow CFI with libslirp >= 4.7,
Paolo Bonzini <=
- [PULL 21/27] coroutine-lock: qemu_co_queue_next is a coroutine-only qemu_co_enter_next, Paolo Bonzini, 2022/05/12
- [PULL 22/27] coroutine-lock: introduce qemu_co_queue_enter_all, Paolo Bonzini, 2022/05/12
- [PULL 08/27] tests/qtest/libqos/pci: Introduce pio_limit, Paolo Bonzini, 2022/05/12
- [PULL 04/27] checkpatch: fix g_malloc check, Paolo Bonzini, 2022/05/12
- [PULL 07/27] hw/xen/xen_pt: Resolve igd_passthrough_isa_bridge_create() indirection, Paolo Bonzini, 2022/05/12
- [PULL 09/27] tests/qtest/libqos: Skip hotplug tests if pci root bus is not hotpluggable, Paolo Bonzini, 2022/05/12
- [PULL 10/27] tests/qtest/libqos: Add generic pci host bridge in arm-virt machine, Paolo Bonzini, 2022/05/12
- [PULL 13/27] machine: add mem compound property, Paolo Bonzini, 2022/05/12
- [PULL 15/27] machine: move more memory validation to Machine object, Paolo Bonzini, 2022/05/12
- [PULL 19/27] net: slirp: add support for CFI-friendly timer API, Paolo Bonzini, 2022/05/12