Opened 6 months ago

Closed 6 months ago

#18751 closed defect (fixed)

Fix regression in alsa-lib that causes segfaults on some systems

Reported by: Douglas R. Reno Owned by: Douglas R. Reno
Priority: normal Milestone: 12.1
Component: BOOK Version: git
Severity: normal Keywords:
Cc:

Description

While working on my tracker-miners ticket, I needed to install and configure ALSA. When I ran speaker-test for the first time, I got a segmentation fault right after the PCM plugin was loaded.

I ended up with the following coredump:

           PID: 1117 (speaker-test)
           UID: 1000 (renodr)
           GID: 1000 (renodr)
        Signal: 11 (SEGV)
     Timestamp: Fri 2023-10-20 16:31:08 CDT (19min ago)
  Command Line: speaker-test
    Executable: /usr/bin/speaker-test
 Control Group: /user.slice/user-1000.slice/session-c1.scope
          Unit: session-c1.scope
         Slice: user-1000.slice
       Session: c1
     Owner UID: 1000 (renodr)
       Boot ID: 54f266cf23ce4ac8802342c734d00800
    Machine ID: 77d31502c2214195aae23abda0f263df
      Hostname: LFSI686
       Storage: /var/lib/systemd/coredump/core.speaker-test.1000.54f266cf23ce4ac8802342c734d00800.1117.1697837468000000.zst (present)
  Size on Disk: 77.4K
       Message: Process 1117 (speaker-test) of user 1000 dumped core.

GNU gdb (GDB) 13.2
Copyright (C) 2023 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 "i686-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://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 /usr/bin/speaker-test...
[New LWP 1117]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
Core was generated by `speaker-test'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0xb7ee9116 in snd_mask_single (mask=<optimized out>)
    at /sources/alsa-lib-1.2.10/alsa-lib-1.2.10/src/pcm/mask_inline.h:204
(gdb) bt
#0  0xb7ee9116 in snd_mask_single (mask=<optimized out>)
    at /sources/alsa-lib-1.2.10/alsa-lib-1.2.10/src/pcm/mask_inline.h:204
#1  snd_mask_refine_set (val=0, mask=0x3)
    at /sources/alsa-lib-1.2.10/alsa-lib-1.2.10/src/pcm/mask_inline.h:274
#2  snd1_pcm_direct_hw_refine (pcm=0x13f3c20, params=0xbf84d6a0)
    at pcm_direct.c:924
#3  0xb7ecadf8 in snd_pcm_plug_hw_refine_slave (
    pcm=0xb7eb2913 <snd1_pcm_hw_refine_slave+179>, params=0x13f4690)
    at pcm_plug.c:992
#4  0x013f4690 in ?? ()
#5  0x0000001b in ?? ()
(gdb) quit

Since it originally appeared to be in the PCM plugin itself, I went searching upstream and came across https://git.alsa-project.org/?p=alsa-lib.git;a=commit;h=0e3dfb9f705ca78be34cd70fd59d67c431e29cc7 (I suspect this would impact Thomas's multilib branch as well, though I don't have one of those builds). That commit on it's own is insufficient though, we also need https://git.alsa-project.org/?p=alsa-lib.git;a=commit;h=81a7a93636d9472fcb0c2ff32d9bfdf6ed10763d, and it was fixed about five weeks ago.

After some further research it looks like the bug was introduced in alsa-lib-1.2.10 (#18499), where the include files were reshuffled to not include "config.h" first. Not including 'config.h' first results in incorrect values for types/sizes.

I've applied those two commits to my system as well as included https://git.alsa-project.org/?p=alsa-lib.git;a=commit;h=96f60d829f2c9dc9ad9eda46410adaa41b4b0da0 ("seq: Fix typos in symbol version definitions"), and speaker-test and friends now work correctly.

Change History (2)

comment:1 by Douglas R. Reno, 6 months ago

Owner: changed from blfs-book to Douglas R. Reno
Status: newassigned
Type: enhancementdefect

comment:2 by Douglas R. Reno, 6 months ago

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.