Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 57291 - aumix segfaults when opening /dev/mixer only from local.start
Summary: aumix segfaults when opening /dev/mixer only from local.start
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Jeremy Huddleston (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-07-16 06:33 UTC by Collins Richey
Modified: 2004-07-22 01:31 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Collins Richey 2004-07-16 06:33:47 UTC
My /etc/conf.d/local.start contains the line 'aumix -L >/dev/null'. When this executes at startup time, I get a segfault. When the same command is run later, no segfault occurs. I'm using glibc-2.3.4.20040619 with nptl enabled, gcc-3.3.3-r6, kernel gentoo-dev-sources-2.6.7-r11, alsa, udev only system. Alsa oss-emulation modules preloaded (otherwise /dev/dsp, /dev/mixer, etc. not generated), aumix-2.8-r1, linux-headers-2.6.6-r1. glibc, bash, aumix, etc. were recompiled with current linux-headers.

Reproducible: Always
Steps to Reproduce:
1.Add 'aumix -L >/dev/null' to /etc/conf.d/local.start
2.
3.

Actual Results:  
segfault opening /dev/mixer (see strace)

Expected Results:  
no segfault

emerge info
Portage 2.0.50-r9 (default-x86-2004.0, gcc-3.3.3, glibc-2.3.4.20040619-r0,
2.6.7-gentoo-r11)
=================================================================
System uname: 2.6.7-gentoo-r11 i686 Intel(R) Pentium(R) 4 CPU 2.40GHz
Gentoo Base System version 1.5.1
ccache version 2.3 [enabled]
Autoconf: sys-devel/autoconf-2.59-r4
Automake: sys-devel/automake-1.8.5-r1
ACCEPT_KEYWORDS="x86 ~x86"
AUTOCLEAN="yes"
CFLAGS="-O2 -pipe -march=i686 -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
COMPILER="gcc3"
CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config
/usr/kde/3.2/share/config /usr/kde/3/share/config /usr/lib/mozilla/defaults/pref
/usr/share/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-O2 -pipe -march=i686 -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs ccache sandbox"
GENTOO_MIRRORS="ftp://gentoo.ccccom.com http://mirror.datapipe.net/gentoo
http://gentoo.osuosl.org/ ftp://ftp.ussg.iu.edu/pub/linux/gentoo
http://mirror.datapipe.net/gentoo"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/portage_overlay"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X acpi alsa apache2 apm avi berkdb cdr crypt cups doc dvdr encode esd
foomaticdb gdbm gif gnome gpm gtk gtk2 imlib java jpeg kde libg++ libwww mad
mikmod motif mozilla mpeg mysql ncurses nls nptl oggvorbis opengl oss pam pdflib
perl png postgres ppds python qt quicktime readline samba scanner sdl slang
spell ssl svga tcltk tcpd tiff truetype usb x86 xml2 xmms xv zlib"
Comment 1 Collins Richey 2004-07-16 06:37:18 UTC
Strace extract prior to failure
----
open("/lib/libz.so.1", O_RDONLY)        = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\300\23"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=65800, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40
7fc000
mmap2(NULL, 67612, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x407
fd000
mmap2(0x4080d000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRIT
E, 3, 0xf) = 0x4080d000
close(3)                                = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40
80e000
set_thread_area({entry_number:-1 -> 6, base_addr:0x4080e350, limit:1048575, seg_
32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, usea
ble:1}) = 0
munmap(0x40017000, 91633)               = 0
open("/dev/urandom", O_RDONLY)          = 3
read(3, "\374E\330=", 4)                = 4
close(3)                                = 0
brk(0)                                  = 0x8055000
brk(0x8076000)                          = 0x8076000
brk(0)                                  = 0x8076000
open("/dev/mixer", O_RDWR)              = 3
ioctl(3, 0x80044dfe, 0x8054790)         = 0
ioctl(3, 0x80044dfd, 0x8054794)         = 0
ioctl(3, 0x80044dff, 0x8054798)         = 0
ioctl(3, 0x80044dfb, 0x805479c)         = 0
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++
Comment 2 Collins Richey 2004-07-16 06:40:49 UTC
strace after system up and running (successful)
-----
open("/lib/libz.so.1", O_RDONLY)        = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\300\23"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=65800, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40
7fc000
mmap2(NULL, 67612, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x407
fd000
mmap2(0x4080d000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRIT
E, 3, 0xf) = 0x4080d000
close(3)                                = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40
80e000
set_thread_area({entry_number:-1 -> 6, base_addr:0x4080e350, limit:1048575, seg_
32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, usea
ble:1}) = 0
munmap(0x40017000, 91633)               = 0
open("/dev/urandom", O_RDONLY)          = 3
read(3, "\233.\264Q", 4)                = 4
close(3)                                = 0
brk(0)                                  = 0x8055000
brk(0x8076000)                          = 0x8076000
brk(0)                                  = 0x8076000
open("/dev/mixer", O_RDWR)              = 3
ioctl(3, 0x80044dfe, 0x8054790)         = 0
ioctl(3, 0x80044dfd, 0x8054794)         = 0
ioctl(3, 0x80044dff, 0x8054798)         = 0
ioctl(3, 0x80044dfb, 0x805479c)         = 0

     ==> note: no segfault this time

stat64("/home/collins/.aumixrc", {st_mode=S_IFREG|0644, st_size=157, ...}) = 0
open("/home/collins/.aumixrc", O_RDONLY) = 4
Comment 3 Collins Richey 2004-07-16 06:46:31 UTC
Please delete this duplicate - generated in error by system (not me) when 57251 was submitted.
Comment 4 Collins Richey 2004-07-16 06:48:57 UTC
Ignore last update - not a duplicate
Comment 5 Collins Richey 2004-07-16 06:56:30 UTC
In case this is a udev problem, I'm using udev-030,hotplug-20040401,             hotplug-base-20040401.
Comment 6 Jeremy Huddleston (RETIRED) gentoo-dev 2004-07-21 10:41:37 UTC
what happens when you add aumix to your default runlevel to save/restore mixer settings?  Does that segfault as well?
Comment 7 Collins Richey 2004-07-21 10:51:44 UTC
I don't understand your suggestion. local.start is the last thing executed in the default runlevel. Please clarify.
Comment 8 Jeremy Huddleston (RETIRED) gentoo-dev 2004-07-21 10:58:53 UTC
rc-update add aumix
reboot
does init.d/aumix cause a segfault?

sorry for being unclear
Comment 9 Collins Richey 2004-07-21 13:34:28 UTC
Thanks for the clarification. Interestingly enough, when started in this manner, aumix does not segfault! Note, /etc/aumixrc does exist. So the basic difference is  direct execution of aumix as opposed to running aumix from a 'source /etc/conf.d/local.start' statement in the case where it segfaults. Any problems with bash? I'll try re-emerging it.
Comment 10 Collins Richey 2004-07-21 14:12:34 UTC
Same results after re-emerging bash. I put the same code (source ...) temporarily in /etc/init.d/aumix, and it also segfaults there. Something not kosher about source from a runscript? At least I have a workaround. Thanks for your help.
Comment 11 Gregorio Guidi (RETIRED) gentoo-dev 2004-07-21 15:57:32 UTC
Got it.

From src/common.c:
	if (save_filename == NULL) {
		home = getenv("HOME");
		if ((strlen(home) + strlen(AUMIXRC) + 2) < PATH_MAX) {
			sprintf(filename, "%s/.%s", home, AUMIXRC);
			setfile = CheckAndOpen(filename, mode);
		}
	...

aumix expects HOME to be set and crashes otherwise (home == NULL). Bug 
triggered only when not using the -f option ("save_filename == NULL").

anyone care to report to the author, a patch should be something like this
--- src/common.c.orig   2004-07-22 00:55:48.956626016 +0200
+++ src/common.c        2004-07-22 00:55:59.317050992 +0200
@@ -591,7 +591,7 @@
        char            filename[PATH_MAX];
        if (save_filename == NULL) {
                home = getenv("HOME");
-               if ((strlen(home) + strlen(AUMIXRC) + 2) < PATH_MAX) {
+               if (home && (strlen(home) + strlen(AUMIXRC) + 2) < PATH_MAX) {
                        sprintf(filename, "%s/.%s", home, AUMIXRC);
                        setfile = CheckAndOpen(filename, mode);
                }
Comment 12 Jeremy Huddleston (RETIRED) gentoo-dev 2004-07-21 20:28:37 UTC
oh god... that's insane.  thanks for finding it =)  Have you sent the patch upstream?  If not, I can do it.  Thanks.
Comment 13 Gregorio Guidi (RETIRED) gentoo-dev 2004-07-22 01:21:14 UTC
Not sent upstream yet, please do (hoping there's someone still alive there,
last release was in november 2002).
Comment 14 Jeremy Huddleston (RETIRED) gentoo-dev 2004-07-22 01:31:43 UTC
fixed in portage.  thanks.