[Bug 1922711] Re: libgccjit randomly segfaults

Christian Henz 1922711 at bugs.launchpad.net
Tue Apr 6 12:42:25 UTC 2021


This crash is introduced by patch pr87808.diff:

[...]
+#ifdef FALLBACK_GCC_EXEC_PREFIX
+  if (gcc_driver_file == NULL && ::getenv ("GCC_EXEC_PREFIX") == NULL)
+    {
+      struct path_prefix path;
+
+      prefix_from_env ("PATH", &path);
[...]

"path" is used uninitialized.

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to gcc-8 in Ubuntu.
https://bugs.launchpad.net/bugs/1922711

Title:
  libgccjit randomly segfaults

Status in gcc-8 package in Ubuntu:
  New

Bug description:
  This test case (taken from Emacs autoconfig, "gcc-8 -o conftest -g3
  -O2 conftest.c -lgccjit") randomly segfaults on Ubuntu 18.04.

  christian at christian-homeoffice:~/Software/src$ ./conftest
  christian at christian-homeoffice:~/Software/src$ ./conftest
  christian at christian-homeoffice:~/Software/src$ ./conftest
  christian at christian-homeoffice:~/Software/src$ ./conftest
  christian at christian-homeoffice:~/Software/src$ ./conftest
  christian at christian-homeoffice:~/Software/src$ ./conftest
  Segmentation fault (core dumped)
  christian at christian-homeoffice:~/Software/src$ ./conftest
  christian at christian-homeoffice:~/Software/src$ ./conftest
  christian at christian-homeoffice:~/Software/src$ ./conftest
  christian at christian-homeoffice:~/Software/src$ ./conftest
  christian at christian-homeoffice:~/Software/src$ ./conftest
  christian at christian-homeoffice:~/Software/src$ ./conftest
  christian at christian-homeoffice:~/Software/src$ ./conftest
  christian at christian-homeoffice:~/Software/src$ ./conftest
  christian at christian-homeoffice:~/Software/src$ ./conftest
  Segmentation fault (core dumped)
  christian at christian-homeoffice:~/Software/src$ ./conftest
  christian at christian-homeoffice:~/Software/src$ ./conftest
  Segmentation fault (core dumped)

  Backtrace in GDB:

  Core was generated by `./conftest'.
  Program terminated with signal SIGSEGV, Segmentation fault.
  #0  do_add_prefix (pprefix=pprefix at entry=0x7ffe29e78c00, prefix=prefix at entry=0x556e0d2586a0 "/home/christian/Software/bear/bin/", first=first at entry=false) at ../../src/gcc/file-find.c:119
  119	../../src/gcc/file-find.c: Datei oder Verzeichnis nicht gefunden.
  (gdb) bt
  #0  do_add_prefix (pprefix=pprefix at entry=0x7ffe29e78c00, prefix=prefix at entry=0x556e0d2586a0 "/home/christian/Software/bear/bin/", first=first at entry=false) at ../../src/gcc/file-find.c:119
  #1  0x00007f417d35dfb7 in add_prefix (pprefix=pprefix at entry=0x7ffe29e78c00, prefix=prefix at entry=0x556e0d2586a0 "/home/christian/Software/bear/bin/") at ../../src/gcc/file-find.c:147
  #2  0x00007f417d35e075 in prefix_from_string (p=<optimized out>, pprefix=pprefix at entry=0x7ffe29e78c00) at ../../src/gcc/file-find.c:201
  #3  0x00007f417d35e15a in prefix_from_env (env=env at entry=0x7f417d3dcb50 "PATH", pprefix=pprefix at entry=0x7ffe29e78c00) at ../../src/gcc/file-find.c:168
  #4  0x00007f417c712a91 in gcc::jit::playback::context::invoke_embedded_driver (this=this at entry=0x7ffe29e78e30, argvec=argvec at entry=0x7ffe29e78c98) at ../../src/gcc/jit/jit-playback.c:2513
  #5  0x00007f417c715341 in gcc::jit::playback::context::invoke_driver(char const*, char const*, char const*, timevar_id_t, bool, bool) () at ../../src/gcc/jit/jit-playback.c:2492
  #6  0x00007f417c7163f8 in gcc::jit::playback::context::convert_to_dso (this=this at entry=0x7ffe29e78e30, ctxt_progname=ctxt_progname at entry=0x7f417d3cff1c "libgccjit.so") at ../../src/gcc/jit/jit-tempdir.h:59
  #7  0x00007f417c71647a in gcc::jit::playback::compile_to_memory::postprocess (this=0x7ffe29e78e30, ctxt_progname=0x7f417d3cff1c "libgccjit.so") at ../../src/gcc/jit/jit-playback.c:1900
  #8  0x00007f417c714e0f in gcc::jit::playback::context::compile (this=this at entry=0x7ffe29e78e30) at ../../src/gcc/jit/jit-playback.c:1873
  #9  0x00007f417c70b374 in gcc::jit::recording::context::compile (this=this at entry=0x556e0d20a730) at ../../src/gcc/jit/jit-recording.c:1352
  #10 0x00007f417c6ff780 in gcc_jit_context_compile (ctxt=0x556e0d20a730) at ../../src/gcc/jit/libgccjit.c:2679
  #11 0x0000556e0b327a49 in main (argc=<optimized out>, argv=<optimized out>) at conftest.c:131

  
  Interestingly, I have not been able to reproduce the crash when running the program directly under gdb.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gcc-8/+bug/1922711/+subscriptions



More information about the foundations-bugs mailing list