NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
lib/41085: sigaction returns EINVAL instead of -1
>Number: 41085
>Category: lib
>Synopsis: sigaction returns EINVAL instead of -1
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: lib-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Mar 27 13:15:00 +0000 2009
>Originator: Matteo Beccati
>Release: 4.0 (XEN DOM0)
>Organization:
>Environment:
NetBSD epia.hq.beccati.com 4.0_STABLE NetBSD 4.0_STABLE (EPIA) #4: Thu Mar 26
18:25:20 CET 2009
toor%epia.hq.beccati.com@localhost:/mnt/usb/src/sys/arch/i386/compile/obj/EPIA
i386
>Description:
Under some circumstances sigaction returns the errno instead of returning -1
and setting the errno variable. Unfortunately I wasn't able to write a self
contained test case. The bug is triggered when running a unit test for the php
pcntl extension (CVS HEAD).
Here's what I found out when running gdb:
Breakpoint 1, php_signal (signo=-1, func=0x82d00f3 <pcntl_signal_handler>,
restart=1) at /root/compile/php-HEAD/ext/pcntl/php_signal.c:28
called php_signal with a valid func pointer and invalid signo.
28 act.sa_handler = func;
(gdb) next
29 sigemptyset(&act.sa_mask);
(gdb) next
30 act.sa_flags = 0;
(gdb) next
sigaction act was set
33 if (signo == SIGALRM || (! restart)) {
(gdb) next
39 act.sa_flags |= SA_RESTART; /* SVR4, 4.3+BSD */
(gdb) next
restart flag also set.
43 retval = sigaction(signo, &act, &oact);
(gdb) step
45 if (retval < 0)
(gdb) print retval
$1 = 22
retval == EINVAL
(gdb) print act
$2 = {_sa_u = {_sa_handler = 0x82d00f3 <pcntl_signal_handler>,
_sa_sigaction = 0x82d00f3 <pcntl_signal_handler>}, sa_mask = {__bits = {0,
0, 0, 0}}, sa_flags = 2}
act looks fine to me
(gdb) print errno
$3 = 0
errno == 0
(gdb) print oact
$4 = {_sa_u = {_sa_handler = 0x8537160, _sa_sigaction = 0x8537160}, sa_mask = {
__bits = {138096588, 136402289, 138096544, 6}}, sa_flags = 15}
oact looks a bit weird.
>How-To-Repeat:
>Fix:
Home |
Main Index |
Thread Index |
Old Index