]> git.proxmox.com Git - mirror_qemu.git/commitdiff
meson: Stop if cfi is enabled with system slirp
authorDaniele Buono <dbuono@linux.vnet.ibm.com>
Thu, 4 Mar 2021 02:59:38 +0000 (21:59 -0500)
committerPaolo Bonzini <pbonzini@redhat.com>
Sat, 6 Mar 2021 10:42:57 +0000 (11:42 +0100)
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.

With this patch, meson will stop if CFI is enabled with system-wide slirp.

In 6.1 we will introduce a new interface to slirp where the callback is
passed as an enum rather than a function pointer.

Signed-off-by: Daniele Buono <dbuono@linux.vnet.ibm.com>
Message-Id: <20210304025939.9164-1-dbuono@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
meson.build

index 07bc23129af750876309635d64ae43647e5eea32..05fb125dc2d77bf385bdd9bac89eb913a057a5ee 100644 (file)
@@ -1574,6 +1574,18 @@ 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
 fdt_opt = get_option('fdt')
 if have_system