Date: Sat, 11 Aug 2001 09:15:04 +0800 (+0800) From: Michael Robinson <robinson@netrinsics.com> To: current@freebsd.org Cc: hackers@freebsd.org Subject: _sigprocmask in malloc.c causes full file table? Message-ID: <200108110115.f7B1F4100321@netrinsics.com>
next in thread | raw e-mail | index | archive | help
I'm currently trying to deal with the problem where malloc/free in a signal handler will crash (in my case, the X window server) if a signal arrives during malloc or free. Following the example of, e.g., stdlib/system.c, I tried blocking the usual suspects (SIGIO, SIGWINCH, etc.), as follows: void free(void *ptr) { sigset_t old_procmask; THREAD_LOCK(); _sigprocmask(SIG_BLOCK, &malloc_procmask, &old_procmask); malloc_func = " in free():"; if (malloc_active++) { wrtwarning("recursive call.\n"); } else { ifree(ptr); UTRACE(ptr, 0, 0); } malloc_active--; _sigprocmask(SIG_SETMASK, &old_procmask, NULL); THREAD_UNLOCK(); return; } That worked for the general case, but it broke mozilla in an interesting way; mozilla would fail to create a kernel pipe in uthread_init.c, and I would get a system error: Aug 11 07:33:25 elephant /boot/kernel/kernel: file: table is full Aug 11 07:33:25 elephant /boot/kernel/kernel: pid 358 (mozilla-bin), uid 1000: exited on signal 6 (core dumped) I then changed the initialization of malloc_procmask so that it contained no signals whatsoever, and the exact same thing happened. I then commented out all calls to sigprocmask, and everything returned to normal. Am I doing something completely boneheaded, or is this an undocumented subtle interaction? -Michael Robinson To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200108110115.f7B1F4100321>