NetBSD Problem Report #58896

From martin@aprisoft.de  Thu Dec 12 11:09:05 2024
Return-Path: <martin@aprisoft.de>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits)
	 client-signature RSA-PSS (2048 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 2ECF91A923C
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 12 Dec 2024 11:09:05 +0000 (UTC)
Message-Id: <20241212110856.A9C6D5CC79F@emmas.aprisoft.de>
Date: Thu, 12 Dec 2024 12:08:56 +0100 (CET)
From: martin@NetBSD.org
Reply-To: martin@NetBSD.org
To: gnats-bugs@NetBSD.org
Subject: gdb sometimes hangs on exit instead of killing inferior processes
X-Send-Pr-Version: 3.95

>Number:         58896
>Notify-List:    riastradh@NetBSD.org, christos@NetBSD.org
>Category:       toolchain
>Synopsis:       gdb sometimes hangs on exit instead of killing inferior processes
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    toolchain-manager
>State:          needs-pullups
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Dec 12 11:10:00 +0000 2024
>Closed-Date:    
>Last-Modified:  Thu May 01 01:58:46 +0000 2025
>Originator:     Martin Husemann
>Release:        NetBSD 10.99.12
>Organization:
The NetBSD Foundation, Inc.
>Environment:
System: NetBSD martins.aprisoft.de 10.99.12 NetBSD 10.99.12 (GENERIC) #251: Mon Nov 25 18:30:20 CET 2024 martin@martins.aprisoft.de:/home/martin/current/src/sys/arch/amd64/compile/GENERIC amd64
Architecture: x86_64
Machine: amd64
>Description:

When exiting gdb while a child is running (and may have crashed, but did not
exit yet) it is supposed to say something like:

	Inferior 1 [process 3380] will be killed.

kill that process and exit. But often (however, I have not been able to
create a recipe to get into that state) it just hangs instead.
When that happens I stop the gdb process (^Z) and kill the primary gdb
process (kill -9 %1). This unlocks the process and all shuts down cleanly
(gdb notices its inferior is gone and terminates).

>How-To-Repeat:

It often happend for me when playing with the gdb tui issue:

 > gdb gdb
 > run
 > tui enable
 (whach inner gdb crash)
 > quit
 (outer gdb won't exit)

>Fix:
n/a

>Release-Note:

>Audit-Trail:
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/58896 CVS commit: src/sys/kern
Date: Sun, 15 Dec 2024 12:42:34 -0500

 Module Name:	src
 Committed By:	christos
 Date:		Sun Dec 15 17:42:34 UTC 2024

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

 Log Message:
 PR/58896: Martin Husemann: PT_KILL will not deliver a kill signal to a stopped
 process: When the process is stopped, the code resumes it instead of sending
 the signal. Change it so that if we are sending SIGKILL, resume and send
 the signal.


 To generate a diff of this commit:
 cvs rdiff -u -r1.93 -r1.94 src/sys/kern/sys_ptrace_common.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->closed
State-Changed-By: christos@NetBSD.org
State-Changed-When: Mon, 16 Dec 2024 17:24:10 -0500
State-Changed-Why:
RCS file: /cvsroot/src/sys/kern/sys_ptrace_common.c,v
revision 1.95
date: 2024-12-16 07:56:12 -0500;  author: christos;  state: Exp;  lines: +3 -3;  commitid: A4AEQGI0WL4y4JBF;
check both for PT_KILL and SIGKILL.


From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/58896 CVS commit: src/tests/lib/libc/sys
Date: Tue, 17 Dec 2024 12:52:23 -0500

 Module Name:	src
 Committed By:	christos
 Date:		Tue Dec 17 17:52:23 UTC 2024

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

 Log Message:
 PR/58896: Martin Husemann: Demonstrate that a PT_STOPed process could not be
 PT_KILLed.


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

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

State-Changed-From-To: closed->needs-pullups
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Thu, 01 May 2025 01:57:40 +0000
State-Changed-Why:
If this is fixed, it needs pullup-9 and pullup-10.

But see also

PR misc/59380: t_ptrace_kill is flaky

...maybe I should've just merged that into this.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2025 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.