[OpenWrt-Devel] Alsa-lib (libasound) segfaults on TLS variable (musl on mips)

Ted Hess thess at kitschensync.net
Tue Jun 23 18:04:35 EDT 2015


I believe this to be an independent problem from the pthread_detach() 
discussion: "musl breaks python". I’m re-posting this to openwrt-devel to get 
more devos aware of the issue. Note that I am using the latest musl/gcc patches 
as of today (23-Jun).

FWIW -- Here's what I know...
To easily reproduce:

    Build alsa-lib & alsa-utils
    Execute: 'aplay -L'        (fails - see below)

--------------------------------------------------------------
Segfault in 'snd_lib_error_set_local' (error.c) referencing
static __thread snd_local_error_handler_t local_error;

Program received signal SIGSEGV, Segmentation fault.
0x0041b164 in snd_lib_error_set_local ()
(gdb) bt
#0 0x0041b164 in snd_lib_error_set_local ()
#1 0x0041fb68 in try_config ()
#2 0x00420d80 in snd_device_name_hint ()
#3 0x0040a3be in pcm_list ()
#4 0x0040e92a in main ()
(gdb) disas
Dump of assembler code for function snd_lib_error_set_local:
0x0041b12c <+0>: lui gp,0x8
0x0041b130 <+4>: addiu gp,gp,23668
0x0041b134 <+8>: addu gp,gp,t9
0x0041b138 <+12>: addiu sp,sp,-16
0x0041b13c <+16>: lw t9,-29872(gp)
0x0041b140 <+20>: sw ra,12(sp)
0x0041b144 <+24>: sw s0,8(sp)
0x0041b148 <+28>: sw gp,0(sp)
0x0041b14c <+32>: move s0,a0
0x0041b150 <+36>: addiu a0,gp,-29376
0x0041b154 <+40>: jalr t9
0x0041b158 <+44>: nop
0x0041b15c <+48>: lui v1,0x0
0x0041b160 <+52>: addu v1,v1,v0
=> 0x0041b164 <+56>: lw v0,-32768(v1)
0x0041b168 <+60>: sw s0,-32768(v1)
0x0041b16c <+64>: lw ra,12(sp)
0x0041b170 <+68>: lw s0,8(sp)
0x0041b174 <+72>: jr ra
0x0041b178 <+76>: addiu sp,sp,16
End of assembler dump.
------------------------------------------------------------

Fails on ar71xx and ramips. Works OK on armeb (NSLU2)
Removing __thread qualifier, rebuild, works OK.

/ted 
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list