The Advanced Linux Sound Architecture (ALSA) - utilities
Find a file
Masatake YAMATO ba2bc072dc alsactl: don't free a card pointing NULL
alsactl distributed as part of Fedora 40 got a SEGV:

    # journalctl
    ...
    May 17 00:55:58 dev64.localdomain kernel: alsactl[1923]: segfault at 28 ip 00005600705b3373 sp 00007ffd9712bef0 error 4 in alsactl[5600705af000+13000] likely on CPU 5 (core 8, socket 0)
    ...

As the following output of the debug session, card_free() tried a card
pointing NULL:

    $ sudo coredumpctl debug alsactl
	       PID: 1923 (alsactl)
	       UID: 0 (root)
	       GID: 0 (root)
	    Signal: 11 (SEGV)
	 Timestamp: Fri 2024-05-17 00:55:58 JST (3h 34min ago)
      Command Line: /usr/sbin/alsactl -s -n 19 -c -E ALSA_CONFIG_PATH=/etc/alsa/alsactl.conf --initfile=/lib/alsa/init/00main rdaemon
	Executable: /usr/sbin/alsactl
     Control Group: /system.slice/alsa-state.service
	      Unit: alsa-state.service
	     Slice: system.slice
	   Boot ID: 241b5a2ef86f4940bb3d340583c80d88
	Machine ID: 437365709a8c488c9481ee4b6651c2ec
	  Hostname: dev64.localdomain
	   Storage: /var/lib/systemd/coredump/core.alsactl.0.241b5a2ef86f4940bb3d340583c80d88.1923.1715874958000000.zst (present)
      Size on Disk: 81.7K
	   Package: alsa-utils/1.2.11-1.fc40
	  build-id: 3b6fec58b3566d666d6e9fd48e8fcf04f03f0152
	   Message: Process 1923 (alsactl) of user 0 dumped core.

		    Module libasound.so.2 from rpm alsa-lib-1.2.11-2.fc40.x86_64
		    Module alsactl from rpm alsa-utils-1.2.11-1.fc40.x86_64
		    Stack trace of thread 1923:
		    #0  0x00005600705b3373 card_free (alsactl + 0xa373)
		    #1  0x00005600705c0e54 state_daemon (alsactl + 0x17e54)
		    #2  0x00005600705b2339 main (alsactl + 0x9339)
		    #3  0x00007f4c0b9b7088 __libc_start_call_main (libc.so.6 + 0x2a088)
		    #4  0x00007f4c0b9b714b __libc_start_main_impl (libc.so.6 + 0x2a14b)
		    #5  0x00005600705b2df5 _start (alsactl + 0x9df5)
		    ELF object binary architecture: AMD x86-64

    GNU gdb (Fedora Linux) 14.2-1.fc40
    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 "x86_64-redhat-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/sbin/alsactl...
    Reading symbols from /usr/lib/debug/usr/sbin/alsactl-1.2.11-1.fc40.x86_64.debug...
    [New LWP 1923]
    [Thread debugging using libthread_db enabled]
    Using host libthread_db library "/lib64/libthread_db.so.1".
    Core was generated by `/usr/sbin/alsactl -s -n 19 -c -E ALSA_CONFIG_PATH=/etc/alsa/alsactl.conf --init'.
    Program terminated with signal SIGSEGV, Segmentation fault.
    #0  free_list (list=0x20) at /usr/src/debug/alsa-utils-1.2.11-1.fc40.x86_64/alsactl/daemon.c:73
    73		for (i = 0; i < list->size; i++)
    (gdb) where
    #0  free_list (list=0x20) at /usr/src/debug/alsa-utils-1.2.11-1.fc40.x86_64/alsactl/daemon.c:73
    #1  card_free (card=card@entry=0x5600707455f0) at /usr/src/debug/alsa-utils-1.2.11-1.fc40.x86_64/alsactl/daemon.c:82
    #2  0x00005600705c0e54 in state_daemon (file=file@entry=0x5600705c31a1 "/var/lib/alsa/asound.state", cardname=cardname@entry=0x0, period=period@entry=300,
	pidfile=pidfile@entry=0x5600705c3170 "/var/run/alsactl.pid") at /usr/src/debug/alsa-utils-1.2.11-1.fc40.x86_64/alsactl/daemon.c:455
    #3  0x00005600705b2339 in main (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/alsa-utils-1.2.11-1.fc40.x86_64/alsactl/alsactl.c:459
    (gdb) list
    68
    69	static void free_list(struct id_list *list)
    70	{
    71		int i;
    72
    73		for (i = 0; i < list->size; i++)
    74			free(list->list[i]);
    75		free(list->list);
    76	}
    77
    (gdb) up
    #1  card_free (card=card@entry=0x5600707455f0) at /usr/src/debug/alsa-utils-1.2.11-1.fc40.x86_64/alsactl/daemon.c:82
    82		free_list(&c->blacklist);
    (gdb) p c
    $1 = (struct card *) 0x0
    (gdb)

Closes: https://github.com/alsa-project/alsa-utils/pull/267
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-05-23 13:17:59 +02:00
.github/workflows chore: Use actions/checkout@v4 2024-03-16 18:54:54 +01:00
alsa-info alsa-info.sh: log SoundWire devices reported in ACPI 2024-04-22 10:03:28 +02:00
alsaconf Add Georgian translation 2022-11-04 22:09:52 +01:00
alsactl alsactl: don't free a card pointing NULL 2024-05-23 13:17:59 +02:00
alsaloop alsaloop: use ATTRIBUTE_UNUSED instead remove argument name 2023-09-04 16:45:39 +02:00
alsamixer alsamixer: fix calculation in set_normalized_volume (overflow) 2024-05-23 13:14:20 +02:00
alsaucm misc: fix incorrect usages of strerror 2023-12-08 20:01:04 +01:00
amidi amidi: use ATTRIBUTE_UNUSED instead remove argument name 2023-09-04 16:37:56 +02:00
amixer reshuffle included files to include config.h as first 2023-08-30 18:48:23 +02:00
aplay aplay: fix S24_LE wav header 2024-04-17 12:05:59 +02:00
axfer axfer: use ATTRIBUTE_UNUSED instead remove argument name 2023-09-04 16:33:47 +02:00
bat bat: really skip analysis of the first period and update related comment 2023-10-17 13:28:13 +02:00
iecset reshuffle included files to include config.h as first 2023-08-30 18:48:23 +02:00
include include: fix package - add bswap.h and os_compat.h to noinst_HEADERS 2023-02-27 13:05:17 +01:00
m4 Fix autoreconf 2005-08-19 13:07:45 +00:00
nhlt nhlt-dmic-info: fix simple memory leak issue 2024-01-17 17:38:27 +01:00
po po: add Korean translations 2023-08-30 18:58:40 +02:00
seq aplaymidi: Set event completely for tempo event 2024-01-08 09:52:55 +01:00
speaker-test speaker-test: Use smaller periods in the default settings 2024-01-24 19:00:10 +01:00
topology topology: nhlt: Intel: Improve all error prints 2024-03-16 19:01:11 +01:00
utils Changed Jaroslav Kysela's e-mail from perex@suse.cz to perex@perex.cz 2007-10-15 10:25:17 +02:00
.gitignore nhlt: add nhlt-dmic-info utility 2023-05-16 15:54:05 +02:00
acinclude.m4 fixed for the recent autoconf. 2004-01-26 15:57:37 +00:00
ChangeLog update build tools. 2005-08-13 16:27:59 +00:00
configure.ac Release v1.2.11 2024-01-29 13:57:30 +01:00
COPYING Updated COPYING with the recent FSF address 2011-06-03 14:24:30 +02:00
gitcompile gitcompile: set more verbose compilation warnings 2023-08-30 15:42:24 +02:00
INSTALL alsactl: Move systemd unit start-up from basic.target to sound.target 2017-10-06 14:32:16 +02:00
Makefile.am nhlt: add nhlt-dmic-info utility 2023-05-16 15:54:05 +02:00
README.md chore: Add link to master branch on GitHub Actions 2022-11-04 22:02:49 +01:00
TODO aplay/arecord 2000-12-27 21:24:57 +00:00

alsa-utils

Advanced Linux Sound Architecture - Utilities

Build alsa-utils

This package contains the command line utilities for the ALSA project. The package can be compiled only with the installed ALSA driver and the ALSA C library (alsa-lib).

Utility Description
alsaconf the ALSA driver configurator script
alsa-info a script to gather information about ALSA subsystem
alsactl an utility for soundcard settings management
aplay/arecord an utility for the playback / capture of .wav,.voc,.au files
axfer an utility to transfer audio data frame (enhancement of aplay)
amixer a command line mixer
alsamixer a ncurses mixer
amidi a utility to send/receive sysex dumps or other MIDI data
iecset a utility to show/set the IEC958 status bits
speaker-test a speaker test utility
alsaloop a software loopback for PCM devices
alsaucm Use Case Manager utility
alsabat a sound tester for ALSA sound card driver
alsatplg ALSA topology compiler

You may give a look for more information about the ALSA project to URL http://www.alsa-project.org.