Regression: glib makes application to crash on centos 7
I am still trying to find out the root cause of this but so far I found out that it is due to the port to meson. We are building glib with the following flags:
-g -O2 -fno-strict-aliasing -Wformat -D_FORTIFY_SOURCE=2 -Wl,-z,relro -Wl,-z,now
We finally managed to update our glib from 2.56.x to the last version using meson (till then we were using autotools). The new version seems to work properly on centos 6, sles12, ubuntu 16 and 18. While on centos 7 we get the following crash:
Program received signal SIGILL, Illegal instruction. 0x00007f6b8c0aee8e in free_async_read_message () from /usr/lib64/dcv/libdcv.so (gdb) bt #0 0x00007f6b8c0aee8e in free_async_read_message () from /usr/lib64/dcv/libdcv.so #1 0x00007f6b8aabc6a5 in g_task_finalize (object=0x55c3d07da530) at ../gio/gtask.c:641 #2 0x00007f6b8ba009c1 in g_object_unref (_object=0x55c3d07da530) at ../gobject/gobject.c:3346 #3 0x00007f6b884216fd in ffi_call_unix64 () at ../subprojects/libffi/src/x86/unix64.S:101 #4 0x00007f6b88420859 in ffi_call_int (cif=cif@entry=0x7ffd18c95840, fn=0x7f6b8c0af3d0 <on_message>, rvalue=<optimized out>, avalue=avalue@entry=0x7ffd18c95750, closure=closure@entry=0x0) at ../subprojects/libffi/src/x86/ffi64.c:667 #5 0x00007f6b88420e4d in ffi_call (cif=cif@entry=0x7ffd18c95840, fn=<optimized out>, rvalue=<optimized out>, avalue=avalue@entry=0x7ffd18c95750) at ../subprojects/libffi/src/x86/ffi64.c:683 #6 0x00007f6b8b9fc620 in g_cclosure_marshal_generic (closure=0x55c3d0a192b0, return_gvalue=0x0, n_param_values=<optimized out>, param_values=<optimized out>, invocation_hint=<optimized out>, marshal_data=0x0) at ../gobject/gclosure.c:1496 #7 0x00007f6b8b9fbde8 in g_closure_invoke (closure=0x55c3d0a192b0, return_value=return_value@entry=0x0, n_param_values=3, param_values=param_values@entry=0x7ffd18c95a40, invocation_hint=invocation_hint@entry=0x7ffd18c959e0) at ../gobject/gclosure.c:810 #8 0x00007f6b8ba0e86d in signal_emit_unlocked_R (node=node@entry=0x55c3d0a1ff80, detail=detail@entry=0, instance=instance@entry=0x55c3d0a208c0, emission_return=emission_return@entry=0x0, instance_and_params=instance_and_params@entry=0x7ffd18c95a40) at ../gobject/gsignal.c:3635 #9 0x00007f6b8ba16a01 in g_signal_emit_valist (instance=<optimized out>, signal_id=<optimized out>, detail=<optimized out>, var_args=var_args@entry=0x7ffd18c95be8) at ../gobject/gsignal.c:3391 #10 0x00007f6b8ba16c62 in g_signal_emit (instance=<optimized out>, signal_id=<optimized out>, detail=<optimized out>) at ../gobject/gsignal.c:3447 #11 0x00007f6b8a7bac82 in on_web_socket_input () from /usr/lib64/dcv/libsoup-2.4.so.1 #12 0x00007f6b8bc8b4c5 in g_main_dispatch (context=0x55c3d07c19f0) at ../glib/gmain.c:3182 #13 g_main_context_dispatch (context=context@entry=0x55c3d07c19f0) at ../glib/gmain.c:3847 #14 0x00007f6b8bc8b838 in g_main_context_iterate (context=context@entry=0x55c3d07c19f0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../glib/gmain.c:3920 #15 0x00007f6b8bc8b8dc in g_main_context_iteration (context=0x55c3d07c19f0, may_block=1) at ../glib/gmain.c:3981 #16 0x00007f6b8c01b4bd in dcv_application_run () from /usr/lib64/dcv/libdcv.so #17 0x000055c3cf7f09f4 in main ()
I discovered that this is specific to the port of glib to meson since I also tried by just building glib 2.56.x with meson and it fails in that way, while if I build it with autotools it works properly. I wonder if there is some align issue in the closures or something. Some idea is welcome here for me to test and try to root cause it.