NetBSD Problem Report #43619
From jmmv@netbsd.org Wed Jul 14 21:23:16 2010
Return-Path: <jmmv@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
by www.NetBSD.org (Postfix) with ESMTP id AEEF763BACE
for <gnats-bugs@gnats.NetBSD.org>; Wed, 14 Jul 2010 21:23:16 +0000 (UTC)
Message-Id: <20100714212316.8AB5A63B100@mail.netbsd.org>
Date: Wed, 14 Jul 2010 21:23:16 +0000 (UTC)
From: jmmv@netbsd.org
Reply-To: jmmv@netbsd.org
To: gnats-bugs@gnats.NetBSD.org
Subject: SA_RESETHAND is broken
X-Send-Pr-Version: 3.95
>Number: 43619
>Category: port-macppc
>Synopsis: SA_RESETHAND is broken
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: port-macppc-maintainer
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Jul 14 21:25:00 +0000 2010
>Closed-Date: Wed Feb 16 21:47:08 +0000 2011
>Last-Modified: Wed Feb 16 21:47:08 +0000 2011
>Originator: Julio Merino
>Release: NetBSD 5.1_RC3
>Organization:
Julio Merino
>Environment:
System: NetBSD mini.julipedia.org 5.1_RC3 NetBSD 5.1_RC3 (MINI) #17: Sat Jul 10 16:01:11 IST 2010 jmmv@mini.julipedia.org:/home/jmmv/os/netbsd/obj.macppc/usr/src/sys/arch/macppc/compile/MINI macppc
Architecture: powerpc
Machine: macppc
>Description:
Signals programmed with the SA_RESETHAND flag set cause the program
to either crash or get stuck in an infinite loop when the signal is
received.
This problem causes some programs to misbehave, which is pretty
annoying in a server setting. For example, the monotone server gets
stuck when started from rc.d as part of the system boot process (I
suspect because it receives some signal).
Haven't been able to confirm if this happens in current yet.
>How-To-Repeat:
Run this program and see it crash in macppc (but work fine on
amd64). Replace SA_RESETHAND with 0 and see it work:
#include <signal.h>
#include <stdbool.h>
#include <stdlib.h>
#include <unistd.h>
static bool handler_called = false;
static void
handler(int signo)
{
handler_called = true;
}
int
main(void)
{
struct sigaction sa;
sa.sa_flags = SA_RESETHAND;
sa.sa_handler = &handler;
sigemptyset(&sa.sa_mask);
sigaction(SIGUSR1, &sa, NULL);
kill(0, SIGUSR1);
return handler_called ? EXIT_SUCCESS : EXIT_FAILURE;
}
The backtrace of the crashed program does not shed much light:
(gdb) bt
#0 0xefeedf24 in kill () from /usr/lib/libc.so.12
#1 0x018008a4 in main () at crash.c:24
(gdb)
>Fix:
>Release-Note:
>Audit-Trail:
From: Julio Merino <jmmv@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/43619 CVS commit: src/tests/kernel
Date: Wed, 14 Jul 2010 21:47:06 +0000
Module Name: src
Committed By: jmmv
Date: Wed Jul 14 21:47:06 UTC 2010
Modified Files:
src/tests/kernel: Makefile
Added Files:
src/tests/kernel: t_sigaction.c
Log Message:
Add a couple of simple tests for sigaction(2): one for the case where flags
is set to 0 and the other for the case where we set SA_RESETHAND.
The latter test is intended to expose PR port-macppc/43619 and is marked as
an expected failure on such platform.
To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/kernel/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/kernel/t_sigaction.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: "Matt Thomas" <matt@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/43619 CVS commit: src/sys/arch/powerpc/powerpc
Date: Mon, 7 Feb 2011 09:39:49 +0000
Module Name: src
Committed By: matt
Date: Mon Feb 7 09:39:49 UTC 2011
Modified Files:
src/sys/arch/powerpc/powerpc: sig_machdep.c
Log Message:
PR port-macppc/43619
Save handler before calling sendsig_reset before it will reset to SIG_DFL
is SA_RESETHAND is set.
To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/powerpc/powerpc/sig_machdep.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->feedback
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Wed, 09 Feb 2011 06:02:09 +0000
State-Changed-Why:
Does it work now?
State-Changed-From-To: feedback->pending-pullups
State-Changed-By: jmmv@NetBSD.org
State-Changed-When: Sat, 12 Feb 2011 09:22:59 +0000
State-Changed-Why:
Applied the fix to the netbsd-5 branch and things appear to work.
Pullup requested. Many thanks for the fix!
From: "Manuel Bouyer" <bouyer@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/43619 CVS commit: [netbsd-5] src/sys/arch/powerpc/powerpc
Date: Wed, 16 Feb 2011 21:16:14 +0000
Module Name: src
Committed By: bouyer
Date: Wed Feb 16 21:16:14 UTC 2011
Modified Files:
src/sys/arch/powerpc/powerpc [netbsd-5]: sig_machdep.c
Log Message:
Pull up following revision(s) (requested by jmmv in ticket #1551):
sys/arch/powerpc/powerpc/sig_machdep.c: revision 1.39 via patch
PR port-macppc/43619
Save handler before calling sendsig_reset before it will reset to SIG_DFL
is SA_RESETHAND is set.
To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.32.12.1 src/sys/arch/powerpc/powerpc/sig_machdep.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: pending-pullups->closed
State-Changed-By: jmmv@NetBSD.org
State-Changed-When: Wed, 16 Feb 2011 21:47:08 +0000
State-Changed-Why:
Pulled up, so we are done!
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.