GNOME Bugzilla – Bug 741099
test-gom-find fail when compiling with "-fPIE -pie" flag with GCC
Last modified: 2015-04-21 23:39:01 UTC
Hi, I don't know if it's due to this one especially, but in Debian, we are compiling using the options hardening=+all. When doing this (with the compile launched out of the autogen.sh and with the options --enable-introspection=yes --enable-gtk-doc=yes), The test fails: ----------- TEST: test-gom-find... (pid=3329) /GomRepository/find: FAIL GTester: last random seed: R02S6cc127829e700387a13142c861acccf0 ----------- When launching the compiled test by hand I have: ----------- ./test-gom-find /GomRepository/find: Segmentation fault ----------- Didn't have the time to debug more in details yet, but with the flag set to hardening=+all,-pie (basically removing the -fPIE flag) I don't have the issue anymore. For more informations about that: https://wiki.debian.org/Hardening#DEB_BUILD_HARDENING_PIE_.28gcc.2Fg.2B-.2B-_-fPIE_-pie.29 I use 0.2.1. Best, Joseph
Thanks for taking the time to report this bug. Without a stack trace from the crash it's very hard to determine what caused it. Can you get us a stack trace? Please see http://live.gnome.org/GettingTraces for more information on how to do so. Thanks in advance!
Hi, So here is what I have when running first the test-tom-find with a bash -x as it's a bash: vagrant@dev01:~/build-area/libgom-0.2.1$ bash -x ./test-gom-find + bash -x ./test-gom-find + sed_quote_subst='s/\([`"$\\]\)/\\\1/g' + test -n '' + case `(set -o) 2>/dev/null` in + set -o posix + BIN_SH=xpg4 + export BIN_SH + DUALCASE=1 + export DUALCASE + unset CDPATH + relink_command='(cd /home/vagrant/build-area/libgom-0.2.1; { test -z "${LIBRARY_PATH+set}" || unset LIBRARY_PATH || { LIBRARY_PATH=; export LIBRARY_PATH; }; }; { test -z "${COMPILER_PATH+set}" || unset COMPILER_PATH || { COMPILER_PATH=; export COMPILER_PATH; }; }; { test -z "${GCC_EXEC_PREFIX+set}" || unset GCC_EXEC_PREFIX || { GCC_EXEC_PREFIX=; export GCC_EXEC_PREFIX; }; }; { test -z "${LD_RUN_PATH+set}" || unset LD_RUN_PATH || { LD_RUN_PATH=; export LD_RUN_PATH; }; }; { test -z "${LD_LIBRARY_PATH+set}" || unset LD_LIBRARY_PATH || { LD_LIBRARY_PATH=; export LD_LIBRARY_PATH; }; }; PATH=/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11; export PATH; gcc -g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -DG_DISABLE_CAST_CHECKS -fPIE -pie -Wl,-z -Wl,relro -Wl,-z -Wl,now -o $progdir/$file ./tests/test_gom_find-test-gom-find.o -lgio-2.0 -lgobject-2.0 -lglib-2.0 ./.libs/libgom-1.0.so -Wl,-rpath -Wl,/home/vagrant/build-area/libgom-0.2.1/.libs)' + test '' = '%%%MAGIC variable%%%' + test '' '!=' '%%%MAGIC variable%%%' + file=./test-gom-find + ECHO='printf %s\n' + lt_option_debug= + func_parse_lt_options ./test-gom-find + lt_script_arg0=./test-gom-find + shift + test -n '' ++ /bin/sed 's%/[^/]*$%%' ++ printf '%s\n' ./test-gom-find + thisdir=. + test x. = x./test-gom-find ++ /bin/sed -n 's/.*-> //p' ++ ls -ld ./test-gom-find + file= + test -n '' + WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=no + test no = yes ++ cd . ++ pwd + absdir=/home/vagrant/build-area/libgom-0.2.1 + test -n /home/vagrant/build-area/libgom-0.2.1 + thisdir=/home/vagrant/build-area/libgom-0.2.1 + program=lt-test-gom-find + progdir=/home/vagrant/build-area/libgom-0.2.1/.libs + test '!' -f /home/vagrant/build-area/libgom-0.2.1/.libs/lt-test-gom-find ++ /bin/sed 1q ++ ls -1dt /home/vagrant/build-area/libgom-0.2.1/.libs/lt-test-gom-find /home/vagrant/build-area/libgom-0.2.1/.libs/../lt-test-gom-find + file=/home/vagrant/build-area/libgom-0.2.1/.libs/lt-test-gom-find + test X/home/vagrant/build-area/libgom-0.2.1/.libs/lt-test-gom-find '!=' X/home/vagrant/build-area/libgom-0.2.1/.libs/lt-test-gom-find + test -f /home/vagrant/build-area/libgom-0.2.1/.libs/lt-test-gom-find + test '' '!=' '%%%MAGIC variable%%%' + func_exec_program + case " $* " in + func_exec_program_core + test -n '' + exec /home/vagrant/build-area/libgom-0.2.1/.libs/lt-test-gom-find /GomRepository/find: Segmentation fault
Then running the debugger on the pt-test-gom-find, I have: vagrant@dev01:~/build-area/libgom-0.2.1$ gdb .libs/lt-test-gom-find + gdb .libs/lt-test-gom-find GNU gdb (Debian 7.7.1+dfsg-5) 7.7.1 Copyright (C) 2014 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from .libs/lt-test-gom-find...done. (gdb) set pagination 0 (gdb) run Starting program: /home/vagrant/build-area/libgom-0.2.1/.libs/lt-test-gom-find [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". /GomRepository/find: [New Thread 0x7ffff5b81700 (LWP 30255)] Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x7ffff5b81700 (LWP 30255)] 0x00007ffff783ddb3 in g_type_class_ref () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
Sorry seems I forgot the most interesting part of the debugger output: (gdb) bt
+ Trace 234403
And a full one gives: (gdb) thread apply all bt full
+ Trace 234404
Thread 2 (Thread 0x7ffff5b81700 (LWP 1358))
Not sure that's related to -fPIE. It probably doesn't like that we're calling g_type_class_ref() from another thread. Should be possible to do the ref'ing in the main thread, and unref in the finish callback.
Could you please test a version with commit 27cd22da69499ae22b2278d95836b250193b0088 added?
Hi Bastien, Sorry for the late answer. I tested with this patch included in 0.3.0 but it still doesn't work when compiling with -fPIE. I'll attach the compilation logs. Here are the backtrace: gdb -se ".libs/lt-test-gom-find" -ex "bt full" -ex "thread apply all bt" --batch -c core warning: core file may not match specified executable file. [New LWP 28709] [New LWP 28695] [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". Core was generated by `/root/git/libgom/.libs/lt-test-gom-find'. Program terminated with signal SIGSEGV, Segmentation fault.
+ Trace 234787
Thread 1 (Thread 0x7fdab6ae1700 (LWP 28709))
Thanks for your help.
Created attachment 298644 [details] Build log Build log of the 0.3.0 using Debian packaging tools
In fact it seems most of the other tests are failing when compiling with this flag: root@9b148b2f9fa6:~/git/libgom# make full-report TEST: test-gom-adapter... (pid=2808) /GomAdapter/open_async: OK PASS: test-gom-adapter TEST: test-gom-repository... (pid=2824) /GomRepository/migrate: OK /GomRepository/test-repo-finalize: OK PASS: test-gom-repository TEST: test-gom-find... (pid=2841) /GomRepository/find: FAIL GTester: last random seed: R02S87ba239eef8bc61e3d04a71fcbfb30e8 (pid=2856) FAIL: test-gom-find TEST: test-gom-find-specific... (pid=2870) /GomRepository/find-simple: FAIL GTester: last random seed: R02Sfab2bcc5318a0ddafaadd0229237b879 (pid=2890) /GomRepository/find-specific: FAIL GTester: last random seed: R02S324f567909a8a1df25c6490770d0df4b (pid=2905) /GomRepository/find-specific-and-full: FAIL GTester: last random seed: R02Sb01448ff49cbd2d25d7a928b9d098249 (pid=2920) /GomRepository/find-specific-and-fullv: FAIL GTester: last random seed: R02S5fd041a3c3deca1c546d303ac864f851 (pid=2935) /GomRepository/find-specific-ensure-priorities: FAIL GTester: last random seed: R02S0e44520a70d38532bad34fd4fa3ebe68 (pid=2950) /GomRepository/find-glob: FAIL GTester: last random seed: R02S3c20faaecdfbd8b53ccae6737372f377 (pid=2965) FAIL: test-gom-find-specific TEST: test-gom-transform... (pid=2979) /GomRepository/transform: FAIL GTester: last random seed: R02S4b3e565952a18b4e380bc7fc43a61cf7 (pid=2999) FAIL: test-gom-transform TEST: test-gom-stress... (pid=3013) /GomRepository/stress: FAIL GTester: last random seed: R02S151c2bcf4eff414bcd7cf43192906eec (pid=3033) /GomRepository/stress2: FAIL GTester: last random seed: R02S0582fb402aa91b2711312612f6c201f9 (pid=3048) FAIL: test-gom-stress TEST: test-gom-migration... (pid=3062) /GomRepository/migration: FAIL GTester: last random seed: R02Seca6194e42ab9e5b9448fdac919867fa (pid=3082) FAIL: test-gom-migration TEST: test-gom-constraints... (pid=3096) /GomResource/unique: FAIL GTester: last random seed: R02S3d1e4a9e7d11cb0a71c6972a470fd31b (pid=3116) /GomResource/not-null: FAIL GTester: last random seed: R02Sb9eabcbf3db2d61198611ed81563c3ec (pid=3131) FAIL: test-gom-constraints TEST: test-gom-insert... (pid=3145) /GomRepository/stress_item: FAIL GTester: last random seed: R02Sffff2871e222335a4e94c9b5243d10fe (pid=3165) /GomRepository/stress_item2: FAIL GTester: last random seed: R02S149628b249575e0b34397559bc1fe3cf (pid=3180) FAIL: test-gom-insert Makefile:1574: recipe for target 'full-report' failed make: *** [full-report] Error 1 I'll try to see if I have other dumps that could contain more precise errors.
Example: # gdb -se "/root/git/libgom/.libs/lt-test-gom-insert" -ex "bt full" -ex "thread apply all bt" --batch -c core warning: core file may not match specified executable file. [New LWP 3250] [New LWP 3249] [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". Core was generated by `/root/git/libgom/.libs/lt-test-gom-insert'. Program terminated with signal SIGSEGV, Segmentation fault.
+ Trace 234794
Thread 2 (Thread 0x7f0114984800 (LWP 3249))
Thread 1 (Thread 0x7f0112518700 (LWP 3250))
Here is a strace of this last executable: # strace /root/git/libgom/.libs/lt-test-gom-insert -m=quick --GTestLogFD=4 execve("/root/git/libgom/.libs/lt-test-gom-insert", ["/root/git/libgom/.libs/lt-test-g"..., "-m=quick", "--GTestLogFD=4"], [/* 9 vars */]) = 0 brk(0) = 0x7f2d87b28000 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f2d877ba000 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) open("/root/git/libgom/.libs/tls/x86_64/libgom-1.0.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) stat("/root/git/libgom/.libs/tls/x86_64", 0x7fff896dcc90) = -1 ENOENT (No such file or directory) open("/root/git/libgom/.libs/tls/libgom-1.0.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) stat("/root/git/libgom/.libs/tls", 0x7fff896dcc90) = -1 ENOENT (No such file or directory) open("/root/git/libgom/.libs/x86_64/libgom-1.0.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) stat("/root/git/libgom/.libs/x86_64", 0x7fff896dcc90) = -1 ENOENT (No such file or directory) open("/root/git/libgom/.libs/libgom-1.0.so.0", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0pw\0\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0755, st_size=486464, ...}) = 0 mmap(NULL, 2216720, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f2d8737e000 mprotect(0x7f2d8739a000, 2097152, PROT_NONE) = 0 mmap(0x7f2d8759a000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1c000) = 0x7f2d8759a000 close(3) = 0 open("/root/git/libgom/.libs/libgio-2.0.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=22807, ...}) = 0 mmap(NULL, 22807, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f2d877b4000 close(3) = 0 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) open("/usr/lib/x86_64-linux-gnu/libgio-2.0.so.0", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0P<\3\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0644, st_size=1537768, ...}) = 0 mmap(NULL, 3640008, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f2d87005000 mprotect(0x7f2d87176000, 2097152, PROT_NONE) = 0 mmap(0x7f2d87376000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x171000) = 0x7f2d87376000 mmap(0x7f2d8737c000, 6856, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f2d8737c000 close(3) = 0 open("/root/git/libgom/.libs/libgobject-2.0.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) open("/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0000\263\0\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0644, st_size=334968, ...}) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f2d877b3000 mmap(NULL, 2432968, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f2d86db3000 mprotect(0x7f2d86e04000, 2093056, PROT_NONE) = 0 mmap(0x7f2d87003000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x50000) = 0x7f2d87003000 close(3) = 0 open("/root/git/libgom/.libs/libglib-2.0.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) open("/lib/x86_64-linux-gnu/libglib-2.0.so.0", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\200\245\1\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0644, st_size=1107040, ...}) = 0 mmap(NULL, 3204776, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f2d86aa4000 mprotect(0x7f2d86bb0000, 2097152, PROT_NONE) = 0 mmap(0x7f2d86db0000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x10c000) = 0x7f2d86db0000 mmap(0x7f2d86db2000, 1704, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f2d86db2000 close(3) = 0 open("/root/git/libgom/.libs/libsqlite3.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) open("/usr/lib/x86_64-linux-gnu/libsqlite3.so.0", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\300\265\0\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0644, st_size=816696, ...}) = 0 mmap(NULL, 2913656, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f2d867dc000 mprotect(0x7f2d8689f000, 2093056, PROT_NONE) = 0 mmap(0x7f2d86a9e000, 20480, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xc2000) = 0x7f2d86a9e000 mmap(0x7f2d86aa3000, 1400, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f2d86aa3000 close(3) = 0 open("/root/git/libgom/.libs/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0P\34\2\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0755, st_size=1729984, ...}) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f2d877b2000 mmap(NULL, 3836448, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f2d86433000 mprotect(0x7f2d865d2000, 2097152, PROT_NONE) = 0 mmap(0x7f2d867d2000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x19f000) = 0x7f2d867d2000 mmap(0x7f2d867d8000, 14880, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f2d867d8000 close(3) = 0 open("/root/git/libgom/.libs/libgmodule-2.0.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) open("/usr/lib/x86_64-linux-gnu/libgmodule-2.0.so.0", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\260\21\0\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0644, st_size=14624, ...}) = 0 mmap(NULL, 2109880, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f2d8622f000 mprotect(0x7f2d86232000, 2093056, PROT_NONE) = 0 mmap(0x7f2d86431000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7f2d86431000 close(3) = 0 open("/root/git/libgom/.libs/libz.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) open("/lib/x86_64-linux-gnu/libz.so.1", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0 \"\0\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0644, st_size=109144, ...}) = 0 mmap(NULL, 2204200, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f2d86014000 mprotect(0x7f2d8602e000, 2093056, PROT_NONE) = 0 mmap(0x7f2d8622d000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x19000) = 0x7f2d8622d000 close(3) = 0 open("/root/git/libgom/.libs/libselinux.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) open("/lib/x86_64-linux-gnu/libselinux.so.1", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\20c\0\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0644, st_size=142728, ...}) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f2d877b1000 mmap(NULL, 2246896, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f2d85def000 mprotect(0x7f2d85e10000, 2097152, PROT_NONE) = 0 mmap(0x7f2d86010000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x21000) = 0x7f2d86010000 mmap(0x7f2d86012000, 6384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f2d86012000 close(3) = 0 open("/root/git/libgom/.libs/libresolv.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) open("/lib/x86_64-linux-gnu/libresolv.so.2", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\220:\0\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0644, st_size=84856, ...}) = 0 mmap(NULL, 2189928, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f2d85bd8000 mprotect(0x7f2d85bec000, 2093056, PROT_NONE) = 0 mmap(0x7f2d85deb000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x13000) = 0x7f2d85deb000 mmap(0x7f2d85ded000, 6760, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f2d85ded000 close(3) = 0 open("/root/git/libgom/.libs/libffi.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) open("/usr/lib/x86_64-linux-gnu/libffi.so.6", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0p\30\0\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0644, st_size=31048, ...}) = 0 mmap(NULL, 2127464, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f2d859d0000 mprotect(0x7f2d859d7000, 2093056, PROT_NONE) = 0 mmap(0x7f2d85bd6000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x6000) = 0x7f2d85bd6000 close(3) = 0 open("/root/git/libgom/.libs/libpcre.so.3", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) open("/lib/x86_64-linux-gnu/libpcre.so.3", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\20\27\0\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0644, st_size=448440, ...}) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f2d877b0000 mmap(NULL, 2543976, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f2d85762000 mprotect(0x7f2d857ce000, 2097152, PROT_NONE) = 0 mmap(0x7f2d859ce000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x6c000) = 0x7f2d859ce000 close(3) = 0 open("/root/git/libgom/.libs/libpthread.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) open("/lib/x86_64-linux-gnu/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\20o\0\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0755, st_size=137440, ...}) = 0 mmap(NULL, 2213008, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f2d85545000 mprotect(0x7f2d8555d000, 2093056, PROT_NONE) = 0 mmap(0x7f2d8575c000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x17000) = 0x7f2d8575c000 mmap(0x7f2d8575e000, 13456, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f2d8575e000 close(3) = 0 open("/root/git/libgom/.libs/libdl.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) open("/lib/x86_64-linux-gnu/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\320\16\0\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0644, st_size=14664, ...}) = 0 mmap(NULL, 2109712, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f2d85341000 mprotect(0x7f2d85344000, 2093056, PROT_NONE) = 0 mmap(0x7f2d85543000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7f2d85543000 close(3) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f2d877af000 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f2d877ae000 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f2d877ac000 arch_prctl(ARCH_SET_FS, 0x7f2d877ac800) = 0 mprotect(0x7f2d867d2000, 16384, PROT_READ) = 0 mprotect(0x7f2d85543000, 4096, PROT_READ) = 0 mprotect(0x7f2d8575c000, 4096, PROT_READ) = 0 mprotect(0x7f2d859ce000, 4096, PROT_READ) = 0 mprotect(0x7f2d85bd6000, 4096, PROT_READ) = 0 mprotect(0x7f2d85deb000, 4096, PROT_READ) = 0 mprotect(0x7f2d86010000, 4096, PROT_READ) = 0 mprotect(0x7f2d8622d000, 4096, PROT_READ) = 0 mprotect(0x7f2d86db0000, 4096, PROT_READ) = 0 mprotect(0x7f2d86431000, 4096, PROT_READ) = 0 mprotect(0x7f2d86a9e000, 12288, PROT_READ) = 0 mprotect(0x7f2d87003000, 4096, PROT_READ) = 0 mprotect(0x7f2d87376000, 16384, PROT_READ) = 0 mprotect(0x7f2d8759a000, 4096, PROT_READ) = 0 mprotect(0x7f2d879c2000, 4096, PROT_READ) = 0 mprotect(0x7f2d877bc000, 4096, PROT_READ) = 0 munmap(0x7f2d877b4000, 22807) = 0 set_tid_address(0x7f2d877acad0) = 3256 set_robust_list(0x7f2d877acae0, 24) = 0 rt_sigaction(SIGRTMIN, {0x7f2d8554b9f0, [], SA_RESTORER|SA_SIGINFO, 0x7f2d855548d0}, NULL, 8) = 0 rt_sigaction(SIGRT_1, {0x7f2d8554ba80, [], SA_RESTORER|SA_RESTART|SA_SIGINFO, 0x7f2d855548d0}, NULL, 8) = 0 rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0 getrlimit(RLIMIT_STACK, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0 statfs("/sys/fs/selinux", 0x7fff896dd460) = -1 ENOENT (No such file or directory) statfs("/selinux", 0x7fff896dd460) = -1 ENOENT (No such file or directory) brk(0) = 0x7f2d87b28000 brk(0x7f2d87b49000) = 0x7f2d87b49000 open("/proc/filesystems", O_RDONLY) = 3 fstat(3, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f2d877b9000 read(3, "nodev\tsysfs\nnodev\trootfs\nnodev\tr"..., 1024) = 355 read(3, "", 1024) = 0 close(3) = 0 munmap(0x7f2d877b9000, 4096) = 0 futex(0x7f2d86db2568, FUTEX_WAKE, 2147483647) = 0 futex(0x7f2d86db2568, FUTEX_WAKE, 2147483647) = 0 open("/dev/urandom", O_RDONLY) = 3 read(3, "\266\235*=U\n\246\201;\352\201\311\360\236\234\366", 16) = 16 close(3) = 0 futex(0x7f2d86db2568, FUTEX_WAKE, 2147483647) = 0 stat(".", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 stat("/root/git/libgom", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 futex(0x7f2d86db2568, FUTEX_WAKE, 2147483647) = 0 write(4, "\0\0\0i\0\0\0\2\0\0\0\2\0\0\0\0\0\0\0\0\0\0\0)/root/gi"..., 105) = -1 EBADF (Bad file descriptor) write(4, "\0\0\0\30\0\0\0\n\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0", 24) = -1 EBADF (Bad file descriptor) write(4, "\0\0\0%\0\0\0\n\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0\rGomRepos"..., 37) = -1 EBADF (Bad file descriptor) write(4, "\0\0\0002\0\0\0\5\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0\32/GomRepo"..., 50) = -1 EBADF (Bad file descriptor) open("/usr/lib/x86_64-linux-gnu/charset.alias", O_RDONLY) = -1 ENOENT (No such file or directory) open("/usr/lib/x86_64-linux-gnu/gconv/gconv-modules.cache", O_RDONLY) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=26258, ...}) = 0 mmap(NULL, 26258, PROT_READ, MAP_SHARED, 3, 0) = 0x7f2d877a5000 close(3) = 0 futex(0x7f2d867d78f8, FUTEX_WAKE_PRIVATE, 2147483647) = 0 fstat(1, {st_mode=S_IFCHR|0600, st_rdev=makedev(136, 2), ...}) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f2d877b9000 write(1, "/GomRepository/stress_item: ", 28/GomRepository/stress_item: ) = 28 futex(0x7f2d86db2568, FUTEX_WAKE, 2147483647) = 0 mmap(NULL, 8392704, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_STACK, -1, 0) = 0x7f2d84b40000 mprotect(0x7f2d84b40000, 4096, PROT_NONE) = 0 clone(child_stack=0x7f2d8533fef0, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, parent_tidptr=0x7f2d853409d0, tls=0x7f2d85340700, child_tidptr=0x7f2d853409d0) = 3257 futex(0x7f2d86db2548, FUTEX_WAKE, 1) = 1 futex(0x7f2d86db2568, FUTEX_WAKE, 2147483647) = 0 futex(0x7f2d86db2568, FUTEX_WAKE, 2147483647) = 0 futex(0x7f2d86db2568, FUTEX_WAKE, 2147483647) = 0 eventfd2(0, O_NONBLOCK|O_CLOEXEC) = 3 write(3, "\1\0\0\0\0\0\0\0", 8) = 8 futex(0x7f2d87b357a0, FUTEX_WAKE, 1) = 1 futex(0x7f2d87b35790, FUTEX_WAKE, 1) = 1 futex(0x7f2d87b36940, FUTEX_WAIT, 0, NULL) = 0 futex(0x7f2d86db2568, FUTEX_WAKE, 2147483647) = 0 futex(0x7f2d86db2568, FUTEX_WAKE, 2147483647) = 0 futex(0x7f2d86db2568, FUTEX_WAKE, 2147483647) = 0 futex(0x7f2d87b357a0, FUTEX_WAKE, 1) = 1 futex(0x7f2d87b35790, FUTEX_WAKE, 1) = 1 futex(0x7f2d87b36940, FUTEX_WAIT, 0, NULL <unfinished ...> +++ killed by SIGSEGV (core dumped) +++ Segmentation fault
To make it more readable I attached a strace of the run of .libs/lt-test-gom-find (which is the previous core dump)
Created attachment 298765 [details] strace of .libs/lt-test-gom-find
Same stack but with -g3 -ggdb: [New LWP 15558] [New LWP 15539] [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". Core was generated by `/root/build-area/libgom-0.3.0/.libs/lt-test-gom-find --quiet -m=quick --GTestLo'. Program terminated with signal SIGSEGV, Segmentation fault.
+ Trace 234795
Thread 1 (Thread 0x7f7c7b6a1700 (LWP 15558))
Just a precision (just to be sure you're able to reproduce the issue on your side), I reproduce it outside of the debian packaging stuffs. I just do (added -g3 and -ggdb for debugging purposes): make distclean export CFLAGS='-g3 -ggdb -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security' export LDFLAGS='-fPIE -pie -Wl,-z,relro -Wl,-z,now' DEB_BUILD_HARDENING=1 ./configure make From the 0.3.0 tarball. Can you check and tell me if you're able to reproduce it on your side please? Thanks Joseph
*** Bug 747341 has been marked as a duplicate of this bug. ***
Created attachment 301191 [details] [review] repository: Fix crash when gom is compiled with -FPIE -pie We shouldn't try to stuff GTypes inside a pointer, use an array of GTypes instead.
This breaks API and ABI. In the meanwhile, don't do that...
Created attachment 301385 [details] gdb of test-gom-constraints The same segfault for test-gom-constraints, test-gom-find-specific, gdb-test-gom-insert, test-gom-transform and test-gom-update. I think the problem is not the same as before. Tested with the latest git version.
Created attachment 301386 [details] gdb on test-gom-find The sigtrap on test-gom-find and test-gom-migration.
The traces are missing glib debugging symbols. Please check which one of the CFLAGS is causing this. I spent enough time trying to detangle this last time...
Created attachment 301470 [details] gdb of test-gom-constraints with glib symbols
Created attachment 301471 [details] gdb on test-gom-find with glib symbols Sorry form the missing glib debug info.
See also bug 748196, which has a different patch. Would be nice to test with that one to see if it solves all those problems.
Yes, is seems that the patch of bug 748196 works. All tests are OK. Beside the patch doesn't break API or ABI.
Thanks for taking the time to report this. This particular bug has already been reported into our bug tracking system, but please feel free to report any further bugs you find. *** This bug has been marked as a duplicate of bug 748196 ***