FS#12441 - Sansa Clip+: a segmentation fault occurs with sim at r31101

Attached to Project: Rockbox
Opened by Akio Idehara (idak) - Saturday, 10 December 2011, 13:36 GMT
Last edited by Thomas Martitz (kugel.) - Monday, 19 December 2011, 08:09 GMT
Task Type Bugs
Category Simulator
Status Closed
Assigned To No-one
Operating System Sansa AMSv2
Severity Low
Priority Normal
Reported Version Daily build (which?)
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


A segmentation fault occurs with Sansa Clip+ sim at r31101.
Real target is all ok.
Sansa Fuze sim and real is all ok.
This task depends upon

Closed by  Thomas Martitz (kugel.)
Monday, 19 December 2011, 08:09 GMT
Reason for closing:  Fixed
Additional comments about closing:  r31359. Thanks Boris
Comment by Frank Gevaerts (fg) - Saturday, 10 December 2011, 14:17 GMT
Please provide more details. When does the segmention fault occur? What operating system are you using?
Comment by Akio Idehara (idak) - Saturday, 10 December 2011, 14:22 GMT
Right after executing ./rockboxui, the segmentation fault occurs.
#simulator window is not displayed.
I'm using Fedora16 x86_64.
Comment by Bertrik Sikken (bertrik) - Saturday, 10 December 2011, 14:34 GMT
I can confirm this (ubuntu 11.10 64-bit), my stacktrace is
#0 0x00007ffff7137724 in sigsuspend () from /lib/x86_64-linux-gnu/
#1 0x000000000047dedb in make_context (ctx=0x8973c8, f=0x484876 <scroll_thread>,
sp=0x8acc40 "ᆳ\336ᆳ\336ᆳ\336ᆳ\336ᆳ\336ᆳ\336ᆳ\336ᆳ\336ᆳ\336ᆳ\336ᆳ\336ᆳ\336ᆳ\336ᆳ\336ᆳ\336ᆳ\336ᆳ\336ᆳ\336ᆳ\336ᆳ\336ᆳ\336ᆳ\336ᆳ\336ᆳ\336ᆳ\336ᆳ\336ᆳ\336ᆳ\336ᆳ\336ᆳ\336ᆳ\336ᆳ\336ᆳ\336ᆳ\336ᆳ\336ᆳ\336ᆳ\336ᆳ\336ᆳ\336ᆳ\336ᆳ\336ᆳ\336ᆳ\336ᆳ\336ᆳ\336ᆳ\336ᆳ\336ᆳ\336ᆳ\336", <incomplete sequence \336>..., stack_size=43008) at /home/bertrik/rockbox.git/rockbox/firmware/target/hosted/thread-unix.c:142
#2 0x000000000047e1f3 in setup_thread (context=0x107bf58) at /home/bertrik/rockbox.git/rockbox/firmware/target/hosted/thread-unix.c:277
#3 0x000000000047f001 in load_context (addr=0x107bf58) at /home/bertrik/rockbox.git/rockbox/firmware/target/hosted/thread-unix.c:303
#4 switch_thread () at /home/bertrik/rockbox.git/rockbox/firmware/thread.c:1269
#5 0x000000000047b51d in sleep (ticks=25) at /home/bertrik/rockbox.git/rockbox/firmware/kernel.c:236
#6 0x000000000040764f in init_tagcache () at /home/bertrik/rockbox.git/rockbox/apps/main.c:329
#7 0x000000000040774a in init () at /home/bertrik/rockbox.git/rockbox/apps/main.c:390
#8 0x00000000004073f1 in main (argc=1, argv=0x7fffffffe1e8) at /home/bertrik/rockbox.git/rockbox/apps/main.c:163
Comment by Frank Gevaerts (fg) - Saturday, 10 December 2011, 14:45 GMT
bertrik: that looks more like the stack you get from the SIGUSR1 handling (which is normal).
I get

Program terminated with signal 11, Segmentation fault.
#0 __memmove_ssse3 () at ../sysdeps/x86_64/multiarch/memcpy-ssse3.S:2821
2821 ../sysdeps/x86_64/multiarch/memcpy-ssse3.S: No such file or directory.
in ../sysdeps/x86_64/multiarch/memcpy-ssse3.S
(gdb) bt
#0 __memmove_ssse3 () at ../sysdeps/x86_64/multiarch/memcpy-ssse3.S:2821
#1 0x0000000000475846 in move_block (ctx=0x1077720, block=0x1077640, shift=-11) at /home/fg/software/rockbox-head/firmware/buflib.c:226
#2 0x00000000004759a5 in buflib_compact (ctx=0x1077720) at /home/fg/software/rockbox-head/firmware/buflib.c:293
#3 0x0000000000475c67 in buflib_compact_and_shrink (ctx=0x1077720, shrink_hints=2147483848) at /home/fg/software/rockbox-head/firmware/buflib.c:366
#4 0x0000000000476066 in buflib_alloc_ex (ctx=0x1077720, size=25, name=0x6dacdc "battery-128x64x1.bmp", ops=0x6c2240)
at /home/fg/software/rockbox-head/firmware/buflib.c:514
#5 0x00000000004769e5 in core_alloc_ex (name=0x6dacdc "battery-128x64x1.bmp", size=144, ops=0x6c2240) at /home/fg/software/rockbox-head/firmware/core_alloc.c:62
#6 0x000000000043a616 in load_skin_bmp (wps_data=0x76cd70, bitmap=0x6dad14, bmpdir=0x7fff61c47790 "/.rockbox/wps/cabbiev2")
at /home/fg/software/rockbox-head/apps/gui/skin_engine/skin_parser.c:1624
#7 0x000000000043a809 in load_skin_bitmaps (wps_data=0x76cd70, bmpdir=0x7fff61c47790 "/.rockbox/wps/cabbiev2")
at /home/fg/software/rockbox-head/apps/gui/skin_engine/skin_parser.c:1679
#8 0x000000000043b6e3 in skin_data_load (screen=SCREEN_MAIN, wps_data=0x76cd70, buf=0x7fff61c47940 "/.rockbox/wps/cabbiev2.wps", isfile=true)
at /home/fg/software/rockbox-head/apps/gui/skin_engine/skin_parser.c:2229
#9 0x00000000004381f2 in skin_load (skin=WPS, screen=SCREEN_MAIN, buf=0x7fff61c47940 "/.rockbox/wps/cabbiev2.wps", isfile=true)
at /home/fg/software/rockbox-head/apps/gui/skin_engine/skin_engine.c:174
#10 0x00000000004384c9 in skin_get_gwps (skin=WPS, screen=SCREEN_MAIN) at /home/fg/software/rockbox-head/apps/gui/skin_engine/skin_engine.c:270
#11 0x0000000000438115 in settings_apply_skins () at /home/fg/software/rockbox-head/apps/gui/skin_engine/skin_engine.c:154
#12 0x00000000004079cc in init () at /home/fg/software/rockbox-head/apps/main.c:423
#13 0x0000000000407641 in main (argc=1, argv=0x7fff61c47ca8) at /home/fg/software/rockbox-head/apps/main.c:163
Comment by Akio Idehara (idak) - Saturday, 17 December 2011, 11:51 GMT
This patch is a work-around fix for the segfault.
Comment by Boris Gjenero (dreamlayers) - Sunday, 18 December 2011, 16:58 GMT
Thanks for the work-around. It fixes the Sansa Clip+ sim in r31352. The problem does not occur in 3.10. I'm using Linux Mint Debian Edition.

It seems the problem is that buflib_compact() can successfully move a block into a hole, and then move the same block again using shift.