From owner-freebsd-hackers@FreeBSD.ORG Sun Jul 11 19:39:40 2010 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 36875106564A for ; Sun, 11 Jul 2010 19:39:40 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-iw0-f182.google.com (mail-iw0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id 02EA48FC15 for ; Sun, 11 Jul 2010 19:39:39 +0000 (UTC) Received: by iwn35 with SMTP id 35so4934628iwn.13 for ; Sun, 11 Jul 2010 12:39:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:content-type; bh=sdip+WrgrBllX4xLKHpy/KTZvbmnjKYECOxJ4JAasAY=; b=LCokYu5B6LqXfQEmcztSDW3x6K2/namufBgcvZ1q/YuMiJ8Pycg8wG3M/1WxyEtGYh hwOneVGWhXCz/eUCqbLzt+MoB8H3FAvg7+AHN33wpBDGL1HhZPMRpTFmmcRIkpXb/FQA kC29WK+WL3hQTT31CbpFEfHV/VHJFCOH+18OQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=RWMCAiwp6Qw2f0jms7bqz+OupeNjLHoNGJclTCCVU3dJ2nQnwYL+s+QGn3RSJ/xxWF fNRuua7o0IwVF0f7NVvfsnVXdX1oc1qrlZsEiro516QuVkkco+YVAOf/C5mxLzauwbm8 TgNV1V3Ai4FAFe9RTasZGj0OMAWc36tlfQ3BE= MIME-Version: 1.0 Received: by 10.231.10.137 with SMTP id p9mr13199469ibp.91.1278877179194; Sun, 11 Jul 2010 12:39:39 -0700 (PDT) Received: by 10.231.192.147 with HTTP; Sun, 11 Jul 2010 12:39:39 -0700 (PDT) Date: Sun, 11 Jul 2010 12:39:39 -0700 Message-ID: From: Garrett Cooper To: hackers@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Cc: Subject: *sigpause hanging on 8.x+ X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Jul 2010 19:39:40 -0000 So, long story short... I've basically ported the open posix testsuite to FreeBSD, and one of the tests tests out sigpause. Unfortunately the sucker hangs on my dev box at home. I've written a short testcase that demonstrates this. It prints out: $ ~/test_sigpause 0 And proceeds to be unresponsive to signals (except SIGSTOP / SIGKILL, as expected). When I monkey around with libc's compat4.3 stuff a bit, this is what comes up: $ env LD_LIBRARY_PATH=$PWD:/usr/src/lib/libc/../libthr ~/test_sigpause 0 before sigemptyset before _sigsuspend So it's getting stuck after calling _sigsuspend. I tried the same thing on a i386 8-STABLE VM and it hangs as well. I tried applying similar printfs in libthr but it's not hitting that code at all (it's now responding to SIGTERM though, which is interesting, but not too interesting to me). I also wrote similar code that exercised the functionality in sigsuspend, by calling sigprocmask beforehand, and it works. Thoughts? -Garrett Dev machine: FreeBSD bayonetta.local 9.0-CURRENT FreeBSD 9.0-CURRENT #1 r206173:209901M: Sun Jul 11 04:18:42 PDT 2010 root@:/usr/obj/usr/src/sys/BAYONETTA amd64 VM: FreeBSD starr-bastion.localdomain 8.0-STABLE FreeBSD 8.0-STABLE #0 r207913: Tue May 11 06:21:57 UTC 2010 root@starr-bastion.localdomain:/usr/obj/usr/src/sys/GENERIC i386 Index: compat-43/sigcompat.c =================================================================== --- compat-43/sigcompat.c (revision 206173) +++ compat-43/sigcompat.c (working copy) @@ -36,6 +36,7 @@ #include "namespace.h" #include #include +#include #include #include "un-namespace.h" #include "libc_private.h" @@ -102,7 +103,9 @@ { sigset_t set; + printf("before sigemptyset\n"); sigemptyset(&set); + printf("before _sigsuspend\n"); set.__bits[0] = mask; return (_sigsuspend(&set)); } @@ -111,10 +114,16 @@ xsi_sigpause(int sig) { sigset_t set; + int rc; + printf("before sigemptyset\n"); sigemptyset(&set); + printf("before sigaddset\n"); sigaddset(&set, sig); - return (_sigsuspend(&set)); + printf("before _sigsuspend\n"); + rc = (_sigsuspend(&set)); + printf("after _sigsuspend\n"); + return rc; } int $ cat ~/test_sigpause.c #include #include int main (void) { printf("0\n"); fflush(stdout); (void) sigpause(1); return 0; } $ cat ~/test_sigsuspend.c #include #include int main (void) { sigset_t oset; sigset_t nset; if (sigprocmask(1, &nset, &oset) == -1) err(1, "sigprocmask(-1, &nset, &oset)"); if (sigprocmask(-1, &nset, &oset) == -1) err(1, "sigprocmask(-1, &nset, &oset)"); return (sigsuspend(&nset)); }