NetBSD Problem Report #47625

From www@NetBSD.org  Wed Mar  6 09:53:58 2013
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	by www.NetBSD.org (Postfix) with ESMTP id 072BF63F0D0
	for <gnats-bugs@gnats.NetBSD.org>; Wed,  6 Mar 2013 09:53:57 +0000 (UTC)
Message-Id: <20130306095357.144BD63F0D0@www.NetBSD.org>
Date: Wed,  6 Mar 2013 09:53:57 +0000 (UTC)
From: anthony.mallet@laas.fr
Reply-To: anthony.mallet@laas.fr
To: gnats-bugs@NetBSD.org
Subject: sigtimedwait(2) blocks forever when passed a zero timeout
X-Send-Pr-Version: www-1.0

>Number:         47625
>Category:       kern
>Synopsis:       sigtimedwait(2) blocks forever when passed a zero timeout
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Mar 06 09:55:00 +0000 2013
>Closed-Date:    Mon Oct 07 07:04:44 +0000 2013
>Last-Modified:  Mon Oct 07 07:04:44 +0000 2013
>Originator:     anthony mallet
>Release:        6.0.1
>Organization:
>Environment:
NetBSD fluffy64-netbsd6 6.0.1 NetBSD 6.0.1 (FLUFFY) #2: Sat Mar  2 20:12:01 CET 2013  root@fluffy64-netbsd6:/usr/obj/sys/arch/amd64/compile/FLUFFY amd64

>Description:
sigtimedwait(2) blocks forever when passed a zero timeout.
This does not match the documented behaviour in the manual, nor the POSIX spec. The system call is expected to return immediately in case of a zero-valued timeout.

The problem is the same on a 6.99.16 -current, i386.

>How-To-Repeat:
/* Compile and run the following, it will block. */

#include <sys/time.h>

#include <errno.h>
#include <signal.h>
#include <stdio.h>
#include <string.h>

int
main()
{
  sigset_t block, dflt;
  struct timespec ts;
  siginfo_t info;
  int r;

  sigemptyset(&block);
  ts.tv_sec = 0;
  ts.tv_nsec = 0;
  r = sigtimedwait(&block, &info, &ts);
  printf("%d %s\n", r, strerror(errno));
  printf("%d\n", info.si_signo);
  return 0;
}

>Fix:

>Release-Note:

>Audit-Trail:
From: "Alan Barrett" <apb@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/47625 CVS commit: src/sys/kern
Date: Fri, 8 Mar 2013 09:33:00 +0000

 Module Name:	src
 Committed By:	apb
 Date:		Fri Mar  8 09:33:00 UTC 2013

 Modified Files:
 	src/sys/kern: sys_sig.c

 Log Message:
 Properly differentiate between infinite timeout and zero timeout.
 Local variable timo = -1 is used for zero timeout (non blocking mode).

 Fixes PR 47625 from anthony.mallet


 To generate a diff of this commit:
 cvs rdiff -u -r1.40 -r1.41 src/sys/kern/sys_sig.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/47625 CVS commit: src/tests/lib/libc/sys
Date: Fri, 8 Mar 2013 10:33:51 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Fri Mar  8 10:33:51 UTC 2013

 Modified Files:
 	src/tests/lib/libc/sys: Makefile
 Added Files:
 	src/tests/lib/libc/sys: t_sigtimedwait_pr_47625.c

 Log Message:
 Add a test program for PR kern/47625, based on the sample code provided
 by anthony mallet.


 To generate a diff of this commit:
 cvs rdiff -u -r1.30 -r1.31 src/tests/lib/libc/sys/Makefile
 cvs rdiff -u -r0 -r1.1 src/tests/lib/libc/sys/t_sigtimedwait_pr_47625.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: christos@zoulas.com (Christos Zoulas)
To: gnats-bugs@NetBSD.org, kern-bug-people@netbsd.org, 
	gnats-admin@netbsd.org, netbsd-bugs@netbsd.org, anthony.mallet@laas.fr
Cc: 
Subject: Re: PR/47625 CVS commit: src/tests/lib/libc/sys
Date: Fri, 8 Mar 2013 09:17:01 -0500

 On Mar 8, 10:35am, martin@netbsd.org ("Martin Husemann") wrote:
 -- Subject: PR/47625 CVS commit: src/tests/lib/libc/sys

 |  Log Message:
 |  Add a test program for PR kern/47625, based on the sample code provided
 |  by anthony mallet.

 Can you remove the pr name from the filename? We've been annotating
 the PR numbers inside the test-cases.

 christos

From: Martin Husemann <martin@duskware.de>
To: Christos Zoulas <christos@zoulas.com>
Cc: gnats-bugs@NetBSD.org, kern-bug-people@netbsd.org,
	gnats-admin@netbsd.org, netbsd-bugs@netbsd.org,
	anthony.mallet@laas.fr
Subject: Re: PR/47625 CVS commit: src/tests/lib/libc/sys
Date: Fri, 8 Mar 2013 15:39:24 +0100

 On Fri, Mar 08, 2013 at 09:17:01AM -0500, Christos Zoulas wrote:
 > Can you remove the pr name from the filename? We've been annotating
 > the PR numbers inside the test-cases.

 That is what got us tons of t_pr test programs - is that realy more
 usefull?

 However, we should rename this one and extend it to a few related
 sigtimedwait tests.

 Martin

From: christos@zoulas.com (Christos Zoulas)
To: Martin Husemann <martin@duskware.de>
Cc: gnats-bugs@NetBSD.org, kern-bug-people@netbsd.org, 
	gnats-admin@netbsd.org, netbsd-bugs@netbsd.org, anthony.mallet@laas.fr
Subject: Re: PR/47625 CVS commit: src/tests/lib/libc/sys
Date: Fri, 8 Mar 2013 09:45:44 -0500

 On Mar 8,  3:39pm, martin@duskware.de (Martin Husemann) wrote:
 -- Subject: Re: PR/47625 CVS commit: src/tests/lib/libc/sys

 | On Fri, Mar 08, 2013 at 09:17:01AM -0500, Christos Zoulas wrote:
 | > Can you remove the pr name from the filename? We've been annotating
 | > the PR numbers inside the test-cases.
 | 
 | That is what got us tons of t_pr test programs - is that realy more
 | usefull?

 These are worse and should also be fixed!
 I mean name the pr in the description like:

 ./fs/ffs/t_mount.c

 | However, we should rename this one and extend it to a few related
 | sigtimedwait tests.

 Yes, please do.

 christos

State-Changed-From-To: open->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Mon, 07 Oct 2013 07:04:44 +0000
State-Changed-Why:
fixed


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(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.