[yoshimi] Crash happening when I enter /usr/share/

  • From: Frank Neumann <beachnase@xxxxxx>
  • To: yoshimi@xxxxxxxxxxxxx
  • Date: Mon, 5 Apr 2021 11:47:30 +0200


Hi all, (and happy easter to those to whom it applies),

I found a reproducible crash (SIGSEGV) today, based on current Yoshimi (git
commit 22beca9b4).

It's happening as soon as I go to Instrument->Load External and then navigate
to my /usr/share folder. That folder is pretty crowded in my (Linux Mint 20.1) 
OS,
it holds some 470 directories and a handful of files.

I was suspecting that either some files/folders have "problematic" characters
in their names, or maybe it's the plain amount of them.

So, I created a copy of that folder structure in /home/xx and started moving
items from it to a ".a" subfolder. And yes, at some point the crashing stops -
roughly when there are only some 406 folders left. It's not a particular folder
that causes the crash to happen - it's about their number, or maybe the 
accumulated
length of the strings of all folders.

The crash is happening in src/MasterUI.cpp - a file generated by FLTK. For the 
record,
my FLTK version is 1.3.4, so "one behind" the current latest release 1.3.5.
The release notes of 1.3.5 don't mention a specific bug fixed in this area.

I have created a Yoshimi debug build and briefly went through the core dump 
with gdb;
find the log below (crash happens in thread #1, at the end of the log). There 
is a
local variable "lineno" which has an unhealthy value and which then I guess 
causes
the SIGSEGV.

This is the code location of the crash:

          while(!tofetch.empty())
          {
              size_t pos = tofetch.find("\n");
              string next = tofetch.substr(0, pos);

              filerline[lineno] = new FilerLine(0, 0, 390, 20);            
<------------------ here
              filerline[lineno]->init(synth,lineno);



The fact that this happens in a generated file makes it appear likely that FLTK
itself is at fault, but maybe there are some "buffer limits" in Yoshimi that
could also be the reason, so I am sending this here first.

Can anyone reproduce this? Or, would you have suggestion how I should further
instrument the code to find out more?

Thanks,
Frank


franky@legolas:~/src/audio/yoshimi-git/build/src> gdb ./yoshimi 
core.yoshimi.1000.6968d14d461a4e7a8126bbc14b8a2903.25877.1617613525000000000000
GNU gdb (Ubuntu 9.2-0ubuntu1~20.04) 9.2 Copyright (C) 2020 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 ./yoshimi...
[New LWP 25882]
[New LWP 25878]
[New LWP 25880]
[New LWP 25881]
[New LWP 25883]
[New LWP 25879]
[New LWP 25877]

warning: Section `.reg-xstate/25882' in core file too small.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `./yoshimi'.
Program terminated with signal SIGSEGV, Segmentation fault.

warning: Section `.reg-xstate/25882' in core file too small.
#0  0x000055ce32b6f7c1 in MasterUI::fillfiler (this=0x7f13180ec190, 
type_name=...)
    at /home/franky/src/audio/yoshimi-git/build/src/MasterUI.cpp:2520
2520                  filerline[lineno]->init(synth,lineno);
[Current thread is 1 (Thread 0x7f1329500700 (LWP 25882))]

(gdb) thread apply all bt

Thread 7 (Thread 0x7f1329e85940 (LWP 25877)):
warning: Section `.reg-xstate/25877' in core file too small.
#0  __pthread_clockjoin_ex (threadid=139720274216704, 
thread_return=0x7fff666fdae0, clockid=<optimized out>, abstime=<optimized out>, 
block=<optimized out>) at pthread_join_common.c:145
#1  0x000055ce32cb2c7e in main (argc=1, argv=0x7fff666fdd18) at 
/home/franky/src/audio/yoshimi-git/build/src/main.cpp:562

Thread 6 (Thread 0x7f1329e03700 (LWP 25879)):
warning: Section `.reg-xstate/25879' in core file too small.
#0  __libc_read (nbytes=4, buf=0x7f1329e02b40, fd=5) at 
../sysdeps/unix/sysv/linux/read.c:26
#1  __libc_read (fd=5, buf=0x7f1329e02b40, nbytes=4) at 
../sysdeps/unix/sysv/linux/read.c:24
#2  0x00007f132ae794c2 in ?? () from /lib/x86_64-linux-gnu/libjack.so.0
#3  0x00007f132ae7c91d in ?? () from /lib/x86_64-linux-gnu/libjack.so.0
#4  0x00007f132ae78280 in ?? () from /lib/x86_64-linux-gnu/libjack.so.0
#5  0x00007f132af9b609 in start_thread (arg=<optimized out>) at 
pthread_create.c:477
#6  0x00007f132a65d293 in clone () at 
../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 5 (Thread 0x7f131f187700 (LWP 25883)):
warning: Section `.reg-xstate/25883' in core file too small.
#0  0x00007f132a653246 in __pselect (nfds=1, readfds=0x7f131f1869f0, 
writefds=0x0, exceptfds=0x0, timeout=<optimized out>, sigmask=<optimized out>) 
at ../sysdeps/unix/sysv/linux/pselect.c:48
#1  0x00007f132aac5be9 in rl_getc () from /lib/x86_64-linux-gnu/libreadline.so.8
#2  0x00007f132aac6503 in rl_read_key () from 
/lib/x86_64-linux-gnu/libreadline.so.8
#3  0x00007f132aaabc82 in readline_internal_char () from 
/lib/x86_64-linux-gnu/libreadline.so.8
#4  0x00007f132aaac4ed in readline () from 
/lib/x86_64-linux-gnu/libreadline.so.8
#5  0x000055ce3272f15b in cli::Parser::readline (this=0x7f131f186be0) at 
/home/franky/src/audio/yoshimi-git/build/src/CLI/Parser.h:151
#6  0x000055ce32708db2 in CmdInterface::cmdIfaceCommandLoop 
(this=0x7f131f186c70) at 
/home/franky/src/audio/yoshimi-git/build/src/CLI/CmdInterface.cpp:89
#7  0x000055ce32cb2044 in commandThread () at 
/home/franky/src/audio/yoshimi-git/build/src/main.cpp:395
#8  0x00007f132af9b609 in start_thread (arg=<optimized out>) at 
pthread_create.c:477
#9  0x00007f132a65d293 in clone () at 
../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 4 (Thread 0x7f1329581700 (LWP 25881)):
warning: Section `.reg-xstate/25881' in core file too small.
#0  syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
#1  0x00007f132ae7a092 in ?? () from /lib/x86_64-linux-gnu/libjack.so.0
#2  0x00007f132ae60909 in ?? () from /lib/x86_64-linux-gnu/libjack.so.0
#3  0x00007f132ae5fa0f in ?? () from /lib/x86_64-linux-gnu/libjack.so.0
#4  0x00007f132ae5f228 in ?? () from /lib/x86_64-linux-gnu/libjack.so.0
#5  0x00007f132ae78280 in ?? () from /lib/x86_64-linux-gnu/libjack.so.0
#6  0x00007f132af9b609 in start_thread (arg=<optimized out>) at 
pthread_create.c:477
#7  0x00007f132a65d293 in clone () at 
../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 3 (Thread 0x7f1329d82700 (LWP 25880)):
warning: Section `.reg-xstate/25880' in core file too small.
#0  0x00007f132a61b3bf in __GI___clock_nanosleep (clock_id=clock_id@entry=0, 
flags=flags@entry=0, req=req@entry=0x7f1329d81c40, rem=rem@entry=0x0) at 
../sysdeps/unix/sysv/linux/clock_nanosleep.c:78
#1  0x00007f132a621047 in __GI___nanosleep 
(requested_time=requested_time@entry=0x7f1329d81c40, 
remaining=remaining@entry=0x0) at nanosleep.c:27
#2  0x00007f132a6539bf in usleep (useconds=<optimized out>) at 
../sysdeps/posix/usleep.c:32
#3  0x000055ce32687862 in InterChange::sortResultsThread (this=0x55ce336fbb30) 
at /home/franky/src/audio/yoshimi-git/build/src/Interface/InterChange.cpp:222
#4  0x000055ce326876b6 in InterChange::_sortResultsThread (arg=0x55ce336fbb30) 
at /home/franky/src/audio/yoshimi-git/build/src/Interface/InterChange.cpp:173
#5  0x00007f132af9b609 in start_thread (arg=<optimized out>) at 
pthread_create.c:477
#6  0x00007f132a65d293 in clone () at 
../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 2 (Thread 0x7f1329e84700 (LWP 25878)):
warning: Section `.reg-xstate/25878' in core file too small.
#0  futex_wait_cancelable (private=<optimized out>, expected=0, 
futex_word=0x55ce3374ddd8) at ../sysdeps/nptl/futex-internal.h:183
#1  __pthread_cond_wait_common (abstime=0x0, clockid=0, mutex=0x55ce3374dd80, 
cond=0x55ce3374ddb0) at pthread_cond_wait.c:508
#2  __pthread_cond_wait (cond=0x55ce3374ddb0, mutex=0x55ce3374dd80) at 
pthread_cond_wait.c:638
#3  0x00007f132ae78d32 in ?? () from /lib/x86_64-linux-gnu/libjack.so.0
#4  0x00007f132ae7083d in ?? () from /lib/x86_64-linux-gnu/libjack.so.0
#5  0x00007f132ae78280 in ?? () from /lib/x86_64-linux-gnu/libjack.so.0
#6  0x00007f132af9b609 in start_thread (arg=<optimized out>) at 
pthread_create.c:477
#7  0x00007f132a65d293 in clone () at 
../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 1 (Thread 0x7f1329500700 (LWP 25882)):
#0  0x000055ce32b6f7c1 in MasterUI::fillfiler (this=0x7f13180ec190, 
type_name="xiz") at 
/home/franky/src/audio/yoshimi-git/build/src/MasterUI.cpp:2520
#1  0x000055ce32b6fd6a in MasterUI::filerselect (this=0x7f13180ec190, item=5) 
at /home/franky/src/audio/yoshimi-git/build/src/MasterUI.cpp:2559
#2  0x000055ce32b6e496 in MasterUI::setfiler (this=0x7f13180ec190, title="", 
name="", save=false, exten=0) at 
/home/franky/src/audio/yoshimi-git/build/src/MasterUI.cpp:2432
#3  0x000055ce32ba3a66 in MasterUI::cb_mastermenu_i (this=0x7f13180ec190, 
o=0x7f13181408c0) at 
/home/franky/src/audio/yoshimi-git/build/src/MasterUI.cpp:252
#4  0x000055ce32b62be5 in MasterUI::cb_mastermenu (o=0x7f13181408c0, v=0x0) at 
/home/franky/src/audio/yoshimi-git/build/src/MasterUI.cpp:425
#5  0x00007f132b067225 in Fl_Widget::do_callback(Fl_Widget*, void*) () from 
/lib/x86_64-linux-gnu/libfltk.so.1.3
#6  0x00007f132b03a16f in Fl_Menu_::picked(Fl_Menu_Item const*) () from 
/lib/x86_64-linux-gnu/libfltk.so.1.3
#7  0x00007f132b03ab3c in Fl_Menu_Bar::handle(int) () from 
/lib/x86_64-linux-gnu/libfltk.so.1.3
#8  0x00007f132b024994 in Fl_Group::handle(int) () from 
/lib/x86_64-linux-gnu/libfltk.so.1.3
#9  0x00007f132b00bff3 in ?? () from /lib/x86_64-linux-gnu/libfltk.so.1.3
#10 0x00007f132b00dffb in Fl::handle_(int, Fl_Window*) () from 
/lib/x86_64-linux-gnu/libfltk.so.1.3
#11 0x00007f132b06e32b in fl_handle(_XEvent const&) () from 
/lib/x86_64-linux-gnu/libfltk.so.1.3
#12 0x00007f132b06fa62 in ?? () from /lib/x86_64-linux-gnu/libfltk.so.1.3
#13 0x00007f132b06fda6 in fl_wait(double) () from 
/lib/x86_64-linux-gnu/libfltk.so.1.3
#14 0x00007f132b00d8fa in Fl::wait(double) () from 
/lib/x86_64-linux-gnu/libfltk.so.1.3
#15 0x000055ce32cb1673 in mainGuiThread (arg=0x7fff666fdb40) at 
/home/franky/src/audio/yoshimi-git/build/src/main.cpp:288
#16 0x00007f132af9b609 in start_thread (arg=<optimized out>) at 
pthread_create.c:477
#17 0x00007f132a65d293 in clone () at 
../sysdeps/unix/sysv/linux/x86_64/clone.S:95
(gdb) p lineno
$1 = 407583984

Yoshimi source code is available from either: 
https://sourceforge.net/projects/yoshimi
Or: https://github.com/Yoshimi/yoshimi
Our list archive is at: https://www.freelists.org/archive/yoshimi
To post, email to yoshimi@xxxxxxxxxxxxx

Other related posts: