NetBSD Problem Report #9983

Received: (qmail 23786 invoked from network); 25 Apr 2000 21:50:31 -0000
Message-Id: <200004252150.e3PLoUI17546@ebola.usanetworks.com>
Date: Tue, 25 Apr 2000 17:50:30 -0400 (EDT)
From: Andrew Brown <atatat@atatdot.net>
To: gnats-bugs@gnats.netbsd.org
Subject: kdump seg faults using vis
X-Send-Pr-Version: 3.95

>Number:         9983
>Category:       bin
>Synopsis:       kdump seg faults using vis
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    bin-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Apr 25 21:51:00 +0000 2000
>Closed-Date:    Wed Apr 26 16:06:14 +0000 2000
>Last-Modified:  Wed Apr 26 16:06:14 +0000 2000
>Originator:     Andrew Brown
>Release:        1.4X from 20000424
>Organization:
none.  just me.
>Environment:
System: NetBSD ebola 1.4X NetBSD 1.4X (RESTON) #2: Mon Apr 24 07:57:34 PDT 2000 root@ebola:/usr/src/sys/arch/i386/compile/RESTON i386

>Description:

	kdump dumps core if the io buffer that it's printing to stdout
	(via vis(3)) ends on a page boundary.  kdump (in ktrgenio())
	calls vis(3) like this:

		(void) vis(visbuf, *dp, VIS_CSTYLE, *(dp+1));

	and if dp can be a pointer into a page that has no page following
	it.  if it does, then the fourth argument to vis(3), the *(dp+1)
	one, will attempt to dereference a pointer into the next page
	that's not there.

	simplistic patch attached.

>How-To-Repeat:

	% ktrace cat /netbsd > /dev/null
	% kdump > /dev/null

>Fix:

Index: kdump.c
===================================================================
RCS file: /cvsroot/basesrc/usr.bin/kdump/kdump.c,v
retrieving revision 1.28
diff -u -r1.28 kdump.c
--- kdump.c	2000/04/10 09:13:45	1.28
+++ kdump.c	2000/04/25 21:45:06
@@ -470,7 +470,7 @@
 	(void)printf("       \"");
 	col = 8;
 	for (; datalen > 0; datalen--, dp++) {
-		(void) vis(visbuf, *dp, VIS_CSTYLE, *(dp+1));
+		(void) vis(visbuf, *dp, VIS_CSTYLE, datalen>1?*(dp+1):0);
 		cp = visbuf;
 		/*
 		 * Keep track of printables and
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: tron 
State-Changed-When: Wed Apr 26 09:05:53 PDT 2000 
State-Changed-Why:  
Patch applied, thanks. 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.