Subject: Fix for the /proc crash
To: None <current-users@sun-lamp.cs.berkeley.edu>
From: Lennart Augustsson <augustss@cs.chalmers.se>
List: current-users
Date: 04/11/1994 20:43:29
The following fixes the bug where you can crash the system
by "cat /proc/2/regs".

	-- Lennart

*** /sys/arch/i386/i386/process_machdep.c.orig	Mon Apr 11 10:05:04 1994
--- /sys/arch/i386/i386/process_machdep.c	Mon Apr 11 14:34:21 1994
***************
*** 86,92 ****
  	void *ptr;
  	struct trapframe *tp;
  
! 	if ((p->p_flag & SLOAD) == 0)
  		return (EIO);
  
  	ptr = (char *) p->p_addr + ((char *) p->p_regs - (char *) kstack);
--- 86,92 ----
  	void *ptr;
  	struct trapframe *tp;
  
! 	if ((p->p_flag & SLOAD) == 0 || p->p_regs == 0)
  		return (EIO);
  
  	ptr = (char *) p->p_addr + ((char *) p->p_regs - (char *) kstack);
***************
*** 119,125 ****
  	struct trapframe *tp;
  	int eflags;
  
! 	if ((p->p_flag & SLOAD) == 0)
  		return (EIO);
  
  	ptr = (char *)p->p_addr + ((char *) p->p_regs - (char *) kstack);
--- 119,125 ----
  	struct trapframe *tp;
  	int eflags;
  
! 	if ((p->p_flag & SLOAD) == 0 || p->p_regs == 0)
  		return (EIO);
  
  	ptr = (char *)p->p_addr + ((char *) p->p_regs - (char *) kstack);

------------------------------------------------------------------------------