gegl_init trigger AddressSanitizer
@hub
Submitted by Hubert Figuière Link to original bug (#790835)
Description
Callig gegl_init when your program is compiled with address sanitizer cause libasan to abort because of an error because of beignet
Compile the attached C program with:
$ gcc beignet-asan.c pkg-config gegl-0.3 --libs --cflags
-fsanitize=address -o beignet-test
Run it:
$ ./beignet-test
=================================================================
==4797==ERROR: AddressSanitizer: alloc-dealloc-mismatch (malloc vs operator delete) on 0x603000060eb0
#0 0x7f5fe184cfd0 in operator delete(void*) (/lib64/libasan.so.4+0xe0fd0)
#1 0x7f5fd5419fa4 (/lib64/libclangFrontend.so.4+0xaafa4)
#2 0x7f5fd5425cbc in clang::CompilerInvocation::CreateFromArgs(clang::CompilerInvocation&, char const* const*, char const* const*, clang::DiagnosticsEngine&) (/lib64/libclangFrontend.so.4+0xb6cbc)
#3 0x7f5fd5740056 (/usr/lib64/beignet//libgbe.so+0x8a056)
#4 0x7f5fd574198b (/usr/lib64/beignet//libgbe.so+0x8b98b)
#5 0x7f5fd76957c0 (/usr/lib64/beignet//libcl.so+0x177c0)
#6 0x7f5fd768a934 in clBuildProgram (/usr/lib64/beignet//libcl.so+0xc934)
#7 0x7f5fd76a35cc (/usr/lib64/beignet//libcl.so+0x255cc)
#8 0x7f5fd76a3779 (/usr/lib64/beignet//libcl.so+0x25779)
#9 0x7f5fd7910231 in clGetDeviceIDs (/lib64/libOpenCL.so.1+0xf231)
#10 0x7f5fd79070b9 (/lib64/libOpenCL.so.1+0x60b9)
#11 0x7f5fd7908a73 in clGetPlatformIDs (/lib64/libOpenCL.so.1+0x7a73)
#12 0x7f5fe15353f3 (/lib64/libgegl-0.3.so.0+0x783f3)
#13 0x7f5fe153606a (/lib64/libgegl-0.3.so.0+0x7906a)
#14 0x7f5fe14e53b6 (/lib64/libgegl-0.3.so.0+0x283b6)
#15 0x7f5fe024373c in g_closure_invoke (/lib64/libgobject-2.0.so.0+0xf73c)
#16 0x7f5fe02564dd (/lib64/libgobject-2.0.so.0+0x224dd)
#17 0x7f5fe025ed04 in g_signal_emit_valist (/lib64/libgobject-2.0.so.0+0x2ad04)
#18 0x7f5fe025f66e in g_signal_emit (/lib64/libgobject-2.0.so.0+0x2b66e)
#19 0x7f5fe0247c03 (/lib64/libgobject-2.0.so.0+0x13c03)
#20 0x7f5fe02475ad (/lib64/libgobject-2.0.so.0+0x135ad)
#21 0x7f5fe024b4f0 in g_object_set_valist (/lib64/libgobject-2.0.so.0+0x174f0)
#22 0x7f5fe024c07b in g_object_set (/lib64/libgobject-2.0.so.0+0x1807b)
#23 0x7f5fe14e5db3 (/lib64/libgegl-0.3.so.0+0x28db3)
#24 0x7f5fe0a9ee2e in g_option_context_parse (/lib64/libglib-2.0.so.0+0x56e2e)
#25 0x7f5fe14e5571 in gegl_init (/lib64/libgegl-0.3.so.0+0x28571)
#26 0x400838 in main /home/hub/tmp/beignet-asan.c:10
#27 0x7f5fdf9cd039 in __libc_start_main (/lib64/libc.so.6+0x21039)
#28 0x400769 in _start (/home/hub/tmp/beignet-test+0x400769)
0x603000060eb0 is located 0 bytes inside of 32-byte region [0x603000060eb0,0x603000060ed0)
allocated by thread T0 here:
#0 0x7f5fe184a850 in malloc (/lib64/libasan.so.4+0xde850)
#1 0x7f5fd0e73397 in operator new(unsigned long) (/lib64/libLLVM-4.0.so+0x1e0d397)
#2 0x60800001689f (`<unknown module>`)
SUMMARY: AddressSanitizer: alloc-dealloc-mismatch (/lib64/libasan.so.4+0xe0fd0) in operator delete(void*)
==4797==HINT: if you don't care about these errors you may set ASAN_OPTIONS=alloc_dealloc_mismatch=0
==4797==ABORTING
This is on Fedora 27
Beignet is 1.3.2 GEGL is 0.3.20
Edited by lillolollo