NetBSD Problem Report #54221

From www@netbsd.org  Tue May 21 17:19:07 2019
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id A2C7C7A169
	for <gnats-bugs@gnats.NetBSD.org>; Tue, 21 May 2019 17:19:07 +0000 (UTC)
Message-Id: <20190521171906.A5E797A1D6@mollari.NetBSD.org>
Date: Tue, 21 May 2019 17:19:06 +0000 (UTC)
From: tobiasu@tmux.org
Reply-To: tobiasu@tmux.org
To: gnats-bugs@NetBSD.org
Subject: sparc64: ddb trace not working as expected
X-Send-Pr-Version: www-1.0

>Number:         54221
>Category:       port-sparc64
>Synopsis:       sparc64: ddb trace not working as expected
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    martin
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue May 21 17:20:00 +0000 2019
>Closed-Date:    Wed May 22 04:18:36 +0000 2019
>Last-Modified:  Fri May 31 02:50:01 +0000 2019
>Originator:     Tobias Ulmer
>Release:        NetBSD 8.99.41
>Organization:
>Environment:
NetBSD u60.tmux.org 8.99.41 NetBSD 8.99.41 (GENERIC.DEBUG) #2: Tue May 21 18:17:19 CEST 2019
>Description:
When in ddb, trace reports only one line of information.

Example (64):
db{0}> trace/t 0t655
trace: pid 655 lid 1 at 0x178e370f1
db{0}>

This is due to an excessive check on stack frame location in 64 bit mode.

It's possible to work around this by specifying /u, but that
only became obvious after inspecting the source.
>How-To-Repeat:

>Fix:
VM_MAX_KERNEL_ADDRESS seems most appropriate for 32 and 64 bit configurations.
Tested on both, works as expected.

diff --git a/sys/arch/sparc64/sparc64/db_trace.c b/sys/arch/sparc64/sparc64/db_trace.c
index 174dec39bd5c..84262b712688 100644
--- a/sys/arch/sparc64/sparc64/db_trace.c
+++ b/sys/arch/sparc64/sparc64/db_trace.c
@@ -163,7 +163,7 @@ db_stack_trace_print(db_expr_t addr, bool have_addr, db_expr_t count,
 		if (kernel_only) {
 			if (pc < KERNBASE || pc >= KERNEND)
 				break;
-			if (frame < KERNBASE || frame >= EINTSTACK)
+			if (frame < KERNBASE || frame > VM_MAX_KERNEL_ADDRESS)
 				break;
 		} else {
 			if (frame == 0 || frame == (vaddr_t)-1)

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: port-sparc64-maintainer->martin
Responsible-Changed-By: martin@NetBSD.org
Responsible-Changed-When: Wed, 22 May 2019 04:18:36 +0000
Responsible-Changed-Why:
Take


State-Changed-From-To: open->closed
State-Changed-By: martin@NetBSD.org
State-Changed-When: Wed, 22 May 2019 04:18:36 +0000
State-Changed-Why:
Equivalent change commited


From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/54221 CVS commit: src/sys/arch/sparc64/sparc64
Date: Wed, 22 May 2019 04:17:39 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Wed May 22 04:17:39 UTC 2019

 Modified Files:
 	src/sys/arch/sparc64/sparc64: db_trace.c

 Log Message:
 Relax test for valid stack frame address (now that we have multiple kernel
 stacks since ... a long time). Just test for a valid kernel VA, using
 the same test as for "pc".
 Very close to a patch suggested by Tobias Ulmer in PR port-sparc64/54221.


 To generate a diff of this commit:
 cvs rdiff -u -r1.50 -r1.51 src/sys/arch/sparc64/sparc64/db_trace.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/54221 CVS commit: src/sys/arch/sparc64/sparc64
Date: Wed, 22 May 2019 07:40:09 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Wed May 22 07:40:09 UTC 2019

 Modified Files:
 	src/sys/arch/sparc64/sparc64: db_trace.c

 Log Message:
 Fix previous and use the original patch from PR port-sparc64/54221
 instead (XXX should fix comments in param.h)


 To generate a diff of this commit:
 cvs rdiff -u -r1.51 -r1.52 src/sys/arch/sparc64/sparc64/db_trace.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/54221 CVS commit: src/sys/arch/sparc64/sparc64
Date: Wed, 22 May 2019 15:10:13 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Wed May 22 15:10:13 UTC 2019

 Modified Files:
 	src/sys/arch/sparc64/sparc64: db_trace.c

 Log Message:
 Add missing include to fix the crash(8) build, from Tobias Ulmer, PR port-sparc64/54221


 To generate a diff of this commit:
 cvs rdiff -u -r1.52 -r1.53 src/sys/arch/sparc64/sparc64/db_trace.c

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

From: "SAITOH Masanobu" <msaitoh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/54221 CVS commit: [netbsd-8] src/sys/arch/sparc64/sparc64
Date: Fri, 31 May 2019 02:48:41 +0000

 Module Name:	src
 Committed By:	msaitoh
 Date:		Fri May 31 02:48:41 UTC 2019

 Modified Files:
 	src/sys/arch/sparc64/sparc64 [netbsd-8]: db_trace.c

 Log Message:
 Pull up following revision(s) (requested by martin in ticket #1274):
 	sys/arch/sparc64/sparc64/db_trace.c: revision 1.51
 	sys/arch/sparc64/sparc64/db_trace.c: revision 1.52
 	sys/arch/sparc64/sparc64/db_trace.c: revision 1.53
 Relax test for valid stack frame address (now that we have multiple kernel
 stacks since ... a long time). Just test for a valid kernel VA, using
 the same test as for "pc".
 Very close to a patch suggested by Tobias Ulmer in PR port-sparc64/54221.
 Fix previous and use the original patch from PR port-sparc64/54221
 instead (XXX should fix comments in param.h)
 Add missing include to fix the crash(8) build, from Tobias Ulmer, PR port-sparc64/54221


 To generate a diff of this commit:
 cvs rdiff -u -r1.50 -r1.50.30.1 src/sys/arch/sparc64/sparc64/db_trace.c

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

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.