Subject: port-i386/5145: "panic: ptdi" when debugging large program
To: None <gnats-bugs@gnats.netbsd.org>
From: Andreas Gustafsson <gson@araneus.fi>
List: netbsd-bugs
Date: 03/10/1998 22:35:53
>Number:         5145
>Category:       port-i386
>Synopsis:       "panic: ptdi" when debugging large program
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    gnats-admin (GNATS administrator)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Mar 10 12:50:00 1998
>Last-Modified:
>Originator:     Andreas Gustafsson
>Organization:
Araneus Information Systems Oy
>Release:        1.3
>Environment:
System: NetBSD guava.araneus.fi 1.3 NetBSD 1.3 (GUAVA) #0: Thu Feb 12 12:46:34 EET 1998 gson@guava.araneus.fi:/z/src/sys/arch/i386/compile/GUAVA i386

>Description:

Debugging a large program with gdb consistently causes NetBSD 1.3
(i386) to panic with "panic: ptdi".

In a message on the port-i386 list, Mark Brinicombe <mark@causality.com>
gave the following analysis of what appears to be the same bug:

  The problem is that procfs_domem tries to fault in the page directly with
  vm_fault(). However with the old pmap (pre UVM) pmap_enter() required that
  a page table already existed for the page being mapped. In the fault
  handler in trap.c a specific check is made and if a page table does not
  exist an additional vm_fault() call is made to obtain a page table prior
  to the vm_fault() call to map the actual faulting page. procfs_domem()
  misses this code so a panic situation can arise.

  With UVM pmap_enter() can handling mapping the page table if it does not
  exist (I believe) so this problem goes away.

>How-To-Repeat:

Attempt to debug the pigiRpc program from the Ptolemy distribution, as
in the following session log.  

  ptolemy@guava% which pigiRpc
  /x/ptolemy/bin.nbsd.386/pigiRpc
  ptolemy@guava% size /x/ptolemy/bin.nbsd.386/pigiRpc
  text    data    bss     dec     hex
  6152192 131072  679020  6962284 6a3c6c
  ptolemy@guava% gdb pigiRpc
  GDB is free software and you are welcome to distribute copies of it
   under certain conditions; type "show copying" to see the conditions.
  There is absolutely no warranty for GDB; type "show warranty" for details.
  GDB 4.16 (i386-netbsd), Copyright 1996 Free Software Foundation, Inc...
  (no debugging symbols found)...
  (gdb) run
  Starting program: /x/ptolemy/bin.nbsd.386/pigiRpc 
  panic: ptdi 35ef063
  Stoped at	_Debugger0x4: leave
  db>  t
  _Debugger(...) at _Debugger+0x4
  _panic(...) at _panic+0x46
  _pmap_enter(...) at _pmap_enter+0x55
  _vm_fault(...) at _vm_fault+0xbca
  gcc2_compiled.(...) at gcc2_compiled.+0x136
  _procfs_domem(...) at _procfs_domem+0x51
  _sys_ptrace(...) at _sys_ptrace+0x2b0
  _syscall() at _syscall+238
  --- syscall (number 26) ---
  0x400ffd7f:
  db>

The pigiRpc binary and kernel dump are available upon request, but I
suspect any sufficiently large program will suffice to repeat the
problem.

>Fix:

Unknown.
>Audit-Trail:
>Unformatted: