Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 539888 - dev-util/geany-plugins - segmentation fault in __strchr_sse2() from /lib64/libc.so.6 (crashes geany)
Summary: dev-util/geany-plugins - segmentation fault in __strchr_sse2() from /lib64/li...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Nathan Phillip Brink (binki) (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-02-12 17:21 UTC by georg
Modified: 2016-05-26 10:23 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge --info dev-util/geany (info-geany.txt,5.39 KB, text/plain)
2015-02-12 17:21 UTC, georg
Details
emerge --info dev-util/geany-plugins (info-geany-plugins.txt,5.46 KB, text/plain)
2015-02-12 17:22 UTC, georg
Details
xz compressed core dump geany file 1/3 (core-dump.tar.xz.aa,976.56 KB, application/x-xz)
2015-02-12 17:25 UTC, georg
Details
xz compressed core dump geany file 2/3 (core-dump.tar.xz.ab,976.56 KB, application/x-xz)
2015-02-12 17:25 UTC, georg
Details
xz compressed core dump geany file 3/3 (core-dump.tar.xz.ac,940.17 KB, application/pkix-attr-cert)
2015-02-12 17:26 UTC, georg
Details
patches to fix two crashes in the debugger plugin (debugger-fix-run-crash.patch,1.73 KB, patch)
2015-04-23 19:34 UTC, georg
Details | Diff
patch 0001 (0001-mutex.patch,832 bytes, patch)
2015-04-23 19:35 UTC, georg
Details | Diff
patch 0002 (0002-debugger-fix-run-crash.patch,1.73 KB, patch)
2015-04-23 19:36 UTC, georg
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description georg 2015-02-12 17:21:37 UTC
Created attachment 396262 [details]
emerge --info dev-util/geany

geany starts normally. geany-plugins are enabled use "debugger". After trying to start the debugger on the target, geany segfaults at 

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff50d6393 in __strchr_sse2 () from /lib64/libc.so.6
(gdb) bt
#0  0x00007ffff50d6393 in __strchr_sse2 () from /lib64/libc.so.6
#1  0x00007fffec53d10a in on_read_from_gdb () from /usr/lib64/geany/debugger.so
#2  0x00007ffff5f197a5 in g_io_unix_dispatch () from /usr/lib64/libglib-2.0.so.0
#3  0x00007ffff5ec47b9 in g_main_dispatch () from /usr/lib64/libglib-2.0.so.0
#4  0x00007ffff5ec5527 in g_main_context_dispatch () from /usr/lib64/libglib-2.0.so.0
#5  0x00007ffff5ec5717 in g_main_context_iterate () from /usr/lib64/libglib-2.0.so.0
#6  0x00007ffff5ec5b44 in g_main_loop_run () from /usr/lib64/libglib-2.0.so.0
#7  0x00007ffff783f063 in gtk_main () from /usr/lib64/libgtk-x11-2.0.so.0
#8  0x00000000004be497 in main ()

So i think this bug is different than #535876
Comment 1 georg 2015-02-12 17:22:04 UTC
Created attachment 396264 [details]
emerge --info dev-util/geany-plugins
Comment 2 georg 2015-02-12 17:25:29 UTC
Created attachment 396266 [details]
xz compressed core dump geany file 1/3
Comment 3 georg 2015-02-12 17:25:56 UTC
Created attachment 396268 [details]
xz compressed core dump geany file 2/3
Comment 4 georg 2015-02-12 17:26:24 UTC
Created attachment 396270 [details]
xz compressed core dump geany file 3/3
Comment 5 georg 2015-02-12 17:27:47 UTC
recreate the xz file
cat core-dump.tar.xz.aa core-dump.tar.xz.ab core-dump.tar.xz.ac > core-dump.tar.xz
tar -xJf core-dump.tar.xz
Comment 6 georg 2015-02-12 17:47:54 UTC
Here is an additional backtrace with debug symbols on

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff50d6393 in __strchr_sse2 () from /lib64/libc.so.6
(gdb) bt
#0  0x00007ffff50d6393 in __strchr_sse2 () from /lib64/libc.so.6
#1  0x00007fffec53d10a in on_read_from_gdb (src=0xe9f780, cond=G_IO_IN, data=0x0) at /var/tmp/portage/dev-util/geany-plugins-1.23/work/geany-plugins-1.23/debugger/src/dbm_gdb.c:585
#2  0x00007ffff5f197a5 in g_io_unix_dispatch () from /usr/lib64/libglib-2.0.so.0
#3  0x00007ffff5ec47b9 in g_main_dispatch () from /usr/lib64/libglib-2.0.so.0
#4  0x00007ffff5ec5527 in g_main_context_dispatch () from /usr/lib64/libglib-2.0.so.0
#5  0x00007ffff5ec5717 in g_main_context_iterate () from /usr/lib64/libglib-2.0.so.0
#6  0x00007ffff5ec5b44 in g_main_loop_run () from /usr/lib64/libglib-2.0.so.0
#7  0x00007ffff783f063 in gtk_main () from /usr/lib64/libgtk-x11-2.0.so.0
#8  0x00000000004be497 in main (argc=1, argv=0x7fffffffe1c8) at main.c:1216
Comment 7 georg 2015-02-12 17:58:08 UTC
In line 
/var/tmp/portage/dev-util/geany-plugins-1.23/work/geany-plugins-1.23/debugger/src/dbm_gdb.c:585
(gdb) fr 1
#1  0x00007fffec53d10a in on_read_from_gdb (src=0xe9f780, cond=G_IO_IN, data=0x0) at /var/tmp/portage/dev-util/geany-plugins-1.23/work/geany-plugins-1.23/debugger/src/dbm_gdb.c:585
585				*(strchr(thread_id, '\"')) = '\0'; 
(gdb) p/x thread_id 
$1 = 0x0

print line
$2 = (gchar *) 0xd0bdf0 "^error,msg=\"Invalid argument: &\""

Obviously strstr did return 0. 
The documentation of strstr tells
http://www.cplusplus.com/reference/cstring/strchr/

Return Value
A pointer to the first occurrence of character in str.
--> If the character is not found, the function returns a null pointer.

From my understanding of that source, maybe the gdb version in gentoo behaves different and doesnt accept a needed argument. From the error message, maybe gdb refuses to start as a sub process with "&" ...
Comment 8 georg 2015-02-12 17:59:39 UTC
Here is the surrounding code segement

	else if (g_str_has_prefix (line, "^error"))
	{
		GList *lines, *iter;
		char *msg;

		/* removing read callback (will pulling all output left manually) */
		g_source_remove(gdb_id_out);

		/* set debugger stopped if is running */
		if (DBS_STOPPED != debug_get_state())
		{
			gchar *thread_id = strstr(line + strlen(line) + 1,"thread-id=\"");
-----> SEGFAULT HERE	*(strchr(thread_id, '\"')) = '\0'; 

			dbg_cbs->set_stopped(atoi(thread_id));
		}
Comment 9 georg 2015-02-12 18:20:38 UTC
I guess the source of the error must be somewhere in fuction 
static gboolean run() (line 716). It queues up the arguments for gdb but i cant figure out what argument is the reason. But on the other hand, the not checked pointer in line 585 is a dealbreaker too.
Comment 10 georg 2015-02-12 20:17:41 UTC
I just build geany from git and the plugins. These exact crash happens at

origin	git://github.com/geany/geany
commit 308041da8d0f7ee938a075cae5d84d90da91c5eb
Merge: 7b17db6 be2b280
Author: Colomban Wendling <ban@herbesfolles.org>

origin git://github.com/geany/geany-plugins
commit c12f0d33c96b6a6fd3a3dc7a876d45311d84a086
Author: Jiří Techet <techet@gmail.com>
Date:   Fri Feb 6 15:44:48 2015 +0100

too.
Comment 11 Jeroen Roovers (RETIRED) gentoo-dev 2015-02-13 10:02:47 UTC
Comment on attachment 396266 [details]
xz compressed core dump geany file 1/3

Core dumps are useful only when you have the exact same binaries. Please attach a full gdb backtrace instead.
Comment 12 Jeroen Roovers (RETIRED) gentoo-dev 2015-02-13 10:03:03 UTC
Comment on attachment 396268 [details]
xz compressed core dump geany file 2/3

Core dumps are useful only when you have the exact same binaries. Please attach a full gdb backtrace instead.
Comment 13 Jeroen Roovers (RETIRED) gentoo-dev 2015-02-13 10:03:14 UTC
Comment on attachment 396270 [details]
xz compressed core dump geany file 3/3

Core dumps are useful only when you have the exact same binaries. Please attach a full gdb backtrace instead.
Comment 14 georg 2015-04-23 19:34:58 UTC
Created attachment 401880 [details, diff]
patches to fix two crashes in the debugger plugin

The first patch fixes the crash
"Attempt to unlock mutex that was not locked" crash when the debugger gets activated

The second patch fixes the crash when the debugger starts (this bugreport).

Source of the first patch:
https://github.com/geany/geany-plugins/pull/156

Source of the second patch:
https://bugs.launchpad.net/ubuntu/+source/geany-plugins/+bug/1354747
Comment 15 georg 2015-04-23 19:35:57 UTC
Created attachment 401882 [details, diff]
patch 0001
Comment 16 georg 2015-04-23 19:36:15 UTC
Created attachment 401884 [details, diff]
patch 0002
Comment 17 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2015-07-16 09:33:46 UTC
We should check if geany-plugins-1.25 has these bugs fixed and perhaps do a stable request right after the 30 days testing period is over.

@reporter: Thank you very much for the detailed research and sorry it took so long for us to pick up on this bug.
Comment 18 Nathan Phillip Brink (binki) (RETIRED) gentoo-dev 2015-07-17 04:25:07 UTC
This issue ( https://github.com/geany/geany-plugins/pull/174 ) and the other ( https://github.com/geany/geany-plugins/pull/156 ) both are parents of the tag 1.25, so these shoudl be fixed in 1.25. I might be worth pulling those patches out into 1.24-r2, though, since the -plugins package is so big there’s a chance 1.25 might break other things for people?
Comment 19 Pacho Ramos gentoo-dev 2016-05-26 10:23:22 UTC
this should be fixed in 1.25 (now going to stable)