Skip to contentSkip to conversation

meson: -display dbus and CFI are incompatible

PATCH In review Paolo Bonzini 4 participants 5 messages Sep 30, 2022 – Oct 3, 2022 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 meson: -display dbus and CFI are incompatible

The generated skeletons for DBus call the finalize method of the parent type using code like

    G_OBJECT_CLASS (qemu_dbus_display1_chardev_skeleton_parent_class)->finalize (object);

However, the finalize method is defined in a shared library that is not compiled with CFI. Do not enable anything that uses gdbus-codegen if --enable-cfi was specified.

---
 meson.build | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
meson.build +6 -1
index f6962834a3..6106daf267 100644
@@ -515,6 +515,7 @@ meson.override_dependency('glib-2.0', glib)
 
 gio = not_found
 gdbus_codegen = not_found
+gdbus_codegen_error = '@0@ requires gdbus-codegen, please install libgio'
 if not get_option('gio').auto() or have_system
   gio = dependency('gio-2.0', required: get_option('gio'),
                    method: 'pkg-config', kwargs: static_kwargs)
@@ -539,6 +540,10 @@ if not get_option('gio').auto() or have_system
                              version: gio.version())
   endif
 endif
+if gdbus_codegen.found() and get_option('cfi')
+  gdbus_codegen = not_found
+  gdbus_codegen_error = '@0@ uses gdbus-codegen, which does not support control flow integrity')
+endif
 
 lttng = not_found
 if 'ust' in get_option('trace_backends')
@@ -1697,7 +1702,7 @@ dbus_display = get_option('dbus_display') \
   .require(gio.version().version_compare('>=2.64'),
            error_message: '-display dbus requires glib>=2.64') \
   .require(gdbus_codegen.found(),
-           error_message: '-display dbus requires gdbus-codegen') \
+           error_message: gdbus_codegen_error.format('-display dbus')) \
   .require(opengl.found() and gbm.found(),
            error_message: '-display dbus requires epoxy/egl and gbm') \
   .allowed()
Signature · 1 line
2.37.3
Reviewed-by on v1 1/1
#1 lore raw

Hi

Quoted 10 lines · Paolo Bonzini

The generated skeletons for DBus call the finalize method of the parent type using code like

G_OBJECT_CLASS
(qemu_dbus_display1_chardev_skeleton_parent_class)->finalize (object);

However, the finalize method is defined in a shared library that is not compiled with CFI. Do not enable anything that uses gdbus-codegen if --enable-cfi was specified.

I had the same analysis. But what if gdbus (or other dependencies) is compiled with CFI ? Note: I have no idea if CFI is meant to be usable in production or just for developers.

Quoted 2 lines
Quoted 42 lines
---
 meson.build | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
meson.build +5 -0
index f6962834a3..6106daf267 100644
@@ -515,6 +515,7 @@ meson.override_dependency('glib-2.0', glib)
 
 gio = not_found
 gdbus_codegen = not_found
+gdbus_codegen_error = '@0@ requires gdbus-codegen, please install libgio'
 if not get_option('gio').auto() or have_system
   gio = dependency('gio-2.0', required: get_option('gio'),
                    method: 'pkg-config', kwargs: static_kwargs)
@@ -539,6 +540,10 @@ if not get_option('gio').auto() or have_system
                              version: gio.version())
   endif
 endif
+if gdbus_codegen.found() and get_option('cfi')
+  gdbus_codegen = not_found
+  gdbus_codegen_error = '@0@ uses gdbus-codegen, which does not support
 control flow integrity')
+endif
 
 lttng = not_found

if 'ust' in get_option('trace_backends')

meson.build +1 -2
@@ -1697,7 +1702,7 @@ dbus_display = get_option('dbus_display') \
   .require(gio.version().version_compare('>=2.64'),
            error_message: '-display dbus requires glib>=2.64') \
   .require(gdbus_codegen.found(),
-           error_message: '-display dbus requires gdbus-codegen') \
+           error_message: gdbus_codegen_error.format('-display dbus')) \
   .require(opengl.found() and gbm.found(),
            error_message: '-display dbus requires epoxy/egl and gbm') \
   .allowed()
--

2.37.3

Signature · 1 line
Marc-André Lureau
#2 lore raw
Quoted 8 lines · Marc-André Lureau

Hi

Quoted 4 lines · Paolo Bonzini

The generated skeletons for DBus call the finalize method of the parent type using code like

Quoted 7 lines
Quoted 5 lines
    G_OBJECT_CLASS (qemu_dbus_display1_chardev_skeleton_parent_class)->finalize (object);

However, the finalize method is defined in a shared library that is not compiled with CFI. Do not enable anything that uses gdbus-codegen if --enable-cfi was specified.

I had the same analysis. But what if gdbus (or other dependencies) is compiled with CFI ? Note: I have no idea if CFI is meant to be usable in production or just for developers.

Yeah, in theory it's possible but I think it's very unlikely. For libslirp QEMU ignores that possibility and requires a version with a fixed API, but that's not really possible for the gdbus superclasses.

Paolo

Quoted 52 lines
Quoted 2 lines
Quoted 38 lines
---
 meson.build | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
meson.build +6 -2
index f6962834a3..6106daf267 100644
@@ -515,6 +515,7 @@ meson.override_dependency('glib-2.0', glib)
 
 gio = not_found
 gdbus_codegen = not_found
+gdbus_codegen_error = '@0@ requires gdbus-codegen, please install libgio'
 if not get_option('gio').auto() or have_system
   gio = dependency('gio-2.0', required: get_option('gio'),
                    method: 'pkg-config', kwargs: static_kwargs)
@@ -539,6 +540,10 @@ if not get_option('gio').auto() or have_system
                              version: gio.version())
   endif
 endif
+if gdbus_codegen.found() and get_option('cfi')
+  gdbus_codegen = not_found
+  gdbus_codegen_error = '@0@ uses gdbus-codegen, which does not support control flow integrity')
+endif
 
 lttng = not_found
 if 'ust' in get_option('trace_backends')
@@ -1697,7 +1702,7 @@ dbus_display = get_option('dbus_display') \
   .require(gio.version().version_compare('>=2.64'),
            error_message: '-display dbus requires glib>=2.64') \
   .require(gdbus_codegen.found(),
-           error_message: '-display dbus requires gdbus-codegen') \
+           error_message: gdbus_codegen_error.format('-display dbus')) \
   .require(opengl.found() and gbm.found(),
            error_message: '-display dbus requires epoxy/egl and gbm') \
   .allowed()
--
Quoted 3 lines

2.37.3

--
Marc-André Lureau

#3 lore raw
In reply to Marc-André Lureau
Quoted 10 lines · Marc-André Lureau

Hi

Quoted 6 lines · Paolo Bonzini

The generated skeletons for DBus call the finalize method of the parent type using code like

G_OBJECT_CLASS
(qemu_dbus_display1_chardev_skeleton_parent_class)->finalize (object);

Quoted 8 lines
Quoted 4 lines

However, the finalize method is defined in a shared library that is not compiled with CFI. Do not enable anything that uses gdbus-codegen if --enable-cfi was specified.

I had the same analysis. But what if gdbus (or other dependencies) is compiled with CFI ? Note: I have no idea if CFI is meant to be usable in production or just for developers.

It is supposed to be for production, but right now it is not usable if you want QEMU modules enabled, so that limits its practicality today.

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 :|
#4 lore raw
In reply to Paolo Bonzini
Quoted 27 lines · Paolo Bonzini

The generated skeletons for DBus call the finalize method of the parent type using code like

    G_OBJECT_CLASS (qemu_dbus_display1_chardev_skeleton_parent_class)->finalize (object);

However, the finalize method is defined in a shared library that is not compiled with CFI. Do not enable anything that uses gdbus-codegen if --enable-cfi was specified.

---
 meson.build | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
meson.build +1 -0
index f6962834a3..6106daf267 100644
@@ -515,6 +515,7 @@ meson.override_dependency('glib-2.0', glib)
 
 gio = not_found
 gdbus_codegen = not_found
+gdbus_codegen_error = '@0@ requires gdbus-codegen, please install libgio'
 if not get_option('gio').auto() or have_system
   gio = dependency('gio-2.0', required: get_option('gio'),
                    method: 'pkg-config', kwargs: static_kwargs)

meson.build if not get_option('gio').auto() or have_system · line 545

Quoted 6 lines
meson.build +3 -0
@@ -539,6 +540,10 @@ if not get_option('gio').auto() or have_system
                              version: gio.version())
   endif
 endif
+if gdbus_codegen.found() and get_option('cfi')
+  gdbus_codegen = not_found
+  gdbus_codegen_error = '@0@ uses gdbus-codegen, which does not support control flow integrity')

FYI, you've got a trailing paren here that will break.

Jason