Skip to contentSkip to conversation

Segfaults in snd_pcm_area_silence() when using softvol

DISCUSSION Tanu Kaskinen 2 participants 2 messages Oct 17, 2012 – May 18, 2014

lore
Share & tools
lore
#0 lore raw

Hi,

A bug was reported to pulseaudio about a segfault in alsa-lib code when using softvol: https://bugs.freedesktop.org/show_bug.cgi?id=51060 . It has been observed by several people, and this mail was prompted by the last bug comment, which rightly recommends getting in touch with the alsa developers:

Quoted 10 lines

I've had this problem too and the problem only occurs with -ftree-vectorize.

It looks to me as if this is a gcc bug, as it produces a "movdqa" or "vmovdqa" instruction which is used with an unaligned pointer.

Now, I have no clue why gcc assumes the pointer would be an aligned one, maybe it is even right and something else is wrong, but I haven't spent too much time digging into this.

Quoted 5 lines

(note that it still happens with gcc 4.7 and the current 4.8 development one)

Also, this bug should probably be brought up with the alsa guys as well, as I don't think pulseaudio is at fault here.

Here's the stack trace for your convenience (see the linked bug for more details)

#0 snd_pcm_area_silence (dst_area=0x7fffe875bb00, dst_offset=<optimized out>, samples=2,

    format=SND_PCM_FORMAT_S16_LE) at pcm.c:2549
#1  0x00007fffe87b4398 in snd_pcm_areas_silence (dst_areas=0x5555557fa100, 
    dst_offset=891, channels=2, frames=439, format=SND_PCM_FORMAT_S16_LE) at pcm.c:2662
#2  0x00007fffe87f9bdb in softvol_convert_stereo_vol (svol=0x555555813cf0, 
    dst_areas=0x5555557fa0e0, dst_offset=891, src_areas=0x5555557fa0e0, 
    src_offset=<optimized out>, channels=2, frames=439) at pcm_softvol.c:286
#3  0x00007fffe87fae58 in snd_pcm_softvol_write_areas (pcm=0x55555581db60, 
    areas=0x5555557fa0e0, offset=891, size=439, slave_areas=0x5555557fa0e0, 
    slave_offset=891, slave_sizep=0x7fffe875bcd0) at pcm_softvol.c:607
#4  0x00007fffe87c6fc7 in snd_pcm_plugin_mmap_commit (pcm=0x55555581db60, 
    offset=<optimized out>, size=439) at pcm_plugin.c:424
#5  0x00007fffe87b9676 in snd_pcm_mmap_commit (pcm=<optimized out>, 
    offset=<optimized out>, frames=<optimized out>) at pcm.c:6584
#6  0x00007fffe8a74876 in mmap_write (on_timeout=false, polled=false, 
    sleep_usec=<synthetic pointer>, u=0x5555557e6d40) at modules/alsa/alsa-sink.c:636

#7 thread_func (userdata=0x5555557e6d40) at modules/alsa/alsa-sink.c:1694 #8 0x00007ffff722c039 in internal_thread_func (userdata=0x55555587ef80)
at pulsecore/thread-posix.c:83
#9 0x00007ffff4a24e2c in ?? () from /lib64/libpthread.so.0 #10 0x00007ffff3ccc1dd in clone () from /lib64/libc.so.6

Signature · 1 line
Tanu
#1 lore raw
Quoted 6 lines · Tanu Kaskinen <tanuk <at> iki.fi> writes:

https://bugs.freedesktop.org/show_bug.cgi?id=51060

Quoted 5 lines

I've had this problem too and the problem only occurs with -ftree-vectorize.

It looks to me as if this is a gcc bug, as it produces a "movdqa" or "vmovdqa" instruction which is used with an unaligned pointer.

I want to point out this is still broken.
alsa-lib 1.0.27.2
gcc 4.8.2

(holy crap gmane, how much more do I have to prune. Just let me post)