NetBSD Problem Report #44432

From www@NetBSD.org  Fri Jan 21 16:56:21 2011
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id 0B44463B883
	for <gnats-bugs@gnats.NetBSD.org>; Fri, 21 Jan 2011 16:56:21 +0000 (UTC)
Message-Id: <20110121165620.3797663B873@www.NetBSD.org>
Date: Fri, 21 Jan 2011 16:56:20 +0000 (UTC)
From: pooka@iki.fi
Reply-To: pooka@iki.fi
To: gnats-bugs@NetBSD.org
Subject: cannot single-step over a call to sigprocmask()
X-Send-Pr-Version: www-1.0

>Number:         44432
>Category:       kern
>Synopsis:       cannot single-step over a call to sigprocmask()
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    kern-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jan 21 17:00:01 +0000 2011
>Closed-Date:    Sat May 20 22:42:16 +0000 2017
>Last-Modified:  Sat May 20 22:42:16 +0000 2017
>Originator:     Antti Kantee
>Release:        
>Organization:
>Environment:
NetBSD/i386 ~5.1
>Description:
gdb enters a loop eternal when single stepping over a call to
sigprocmask().
>How-To-Repeat:
#include <signal.h>
#include <stdio.h>

int
main()
{
        sigset_t set;

        sigfillset(&set);
        sigprocmask(SIG_SETMASK, &set, NULL);
        printf("hello, world!\n");

}

(gdb) break main
Breakpoint 1 at 0x8048761: file test.c, line 9.
(gdb) run
Starting program: /usr/home/pooka/a.out 

Breakpoint 1, main () at test.c:9
9               sigfillset(&set);
(gdb) next
10              sigprocmask(SIG_SETMASK, &set, NULL);
(gdb) 
*hang, a.out consumes 100% cpu*


Single stepping the same program on e.g. Linux works fine.
>Fix:

>Release-Note:

>Audit-Trail:

From: Antti Kantee <pooka@cs.hut.fi>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: kern/44432
Date: Mon, 24 Jan 2011 12:45:53 +0200

 I confirmed this happens on -current as well.  I adjusted the priority
 to "high".

From: uwe@stderr.spb.ru (Valeriy E. Ushakov)
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: kern/44432
Date: Mon, 24 Jan 2011 19:28:13 +0300 (MSK)

 In article <20110124105004.7DEC463B873@www.NetBSD.org> you wrote:

 > I confirmed this happens on -current as well.  I adjusted the
 > priority to "high".

 This also happens on 1.6.2, i.e. "forever".  Is the "high" really
 justified?

 -uwe

From: Nick Hudson <nick.hudson@gmx.co.uk>
To: gnats-bugs@netbsd.org
Cc: kern-bug-people@netbsd.org,
 gnats-admin@netbsd.org,
 netbsd-bugs@netbsd.org
Subject: Re: kern/44432: cannot single-step over a call to sigprocmask()
Date: Mon, 24 Jan 2011 16:43:37 +0000

 On Friday 21 January 2011 17:00:01 pooka@iki.fi wrote:
 [...]
 > #include <signal.h>
 > #include <stdio.h>
 > 
 > int
 > main()
 > {
 >         sigset_t set;
 > 
 >         sigfillset(&set);
 >         sigprocmask(SIG_SETMASK, &set, NULL);
 >         printf("hello, world!\n");
 > 
 > }

 If it wasn't obvious... deleting SIGTRAP from the sigset_t allows gdb to 
 step/next over the sigprocmask call.

 Nick

From: Antti Kantee <pooka@iki.fi>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: kern/44432: cannot single-step over a call to sigprocmask()
Date: Mon, 24 Jan 2011 18:53:31 +0200

 On Mon Jan 24 2011 at 16:45:02 +0000, Nick Hudson wrote:
 >  On Friday 21 January 2011 17:00:01 pooka@iki.fi wrote:
 >  [...]
 >  > #include <signal.h>
 >  > #include <stdio.h>
 >  > 
 >  > int
 >  > main()
 >  > {
 >  >         sigset_t set;
 >  > 
 >  >         sigfillset(&set);
 >  >         sigprocmask(SIG_SETMASK, &set, NULL);
 >  >         printf("hello, world!\n");
 >  > 
 >  > }
 >  
 >  If it wasn't obvious... deleting SIGTRAP from the sigset_t allows gdb to 
 >  step/next over the sigprocmask call.

 So does commenting out the call to sigprocmask, and it's less typing ;)

 I'm secretly hoping this is related to multithreaded programs randomly
 hanging under gdb since the symptoms are exactly the same: debugged
 program starts consuming 100% cpu.

 -- 
 älä karot toivorikkauttas, kyl rätei ja lumpui piisaa

From: David Holland <dholland-bugs@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: kern/44432: cannot single-step over a call to sigprocmask()
Date: Mon, 31 Jan 2011 05:50:12 +0000

 On Mon, Jan 24, 2011 at 04:55:01PM +0000, Antti Kantee wrote:
  >  I'm secretly hoping this is related to multithreaded programs randomly
  >  hanging under gdb since the symptoms are exactly the same: debugged
  >  program starts consuming 100% cpu.

 That's ... pretty plausible actually. Does libpthread block SIGTRAP
 anywhere?

 I guess the reason it starts looping is some argument between ptrace
 and trap handling...

 -- 
 David A. Holland
 dholland@netbsd.org

State-Changed-From-To: open->feedback
State-Changed-By: christos@NetBSD.org
State-Changed-When: Sun, 04 Sep 2011 13:55:36 -0400
State-Changed-Why:
I don't think this is a bug; if you don't want to block sigtrap, then don't
block it. I think that adding more special cased code in the kernel to handle
that is a losing proposition.


State-Changed-From-To: feedback->closed
State-Changed-By: kamil@NetBSD.org
State-Changed-When: Sun, 21 May 2017 00:42:16 +0200
State-Changed-Why:
Duplicates more generic PR 51918.
Issue still open. ATF tests adding to test this.


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