[comp.bugs.4bsd] ptrace and the 68881

ray@gibbs.physics.purdue.edu (Ray Moody) (07/08/89)

Index:	sys/sys_process.c 4.3BSD + ISI4.0D

Version:
	    This bug is in Integrated Solutions Incorporated
	implementation of ptrace.  It does not appear in standard 4.3 BSD.

Description:
	    Ptrace does not allow writes to u.U_FLOAT.  If you use
	dbx, this makes no difference whatsoever (because dbx can't handle
	register floats anyway), but it is important if you use gcc and gdb.

Repeat-By:
	    Run gdb and try to set a register variable (even a register
	variable declared as an integer).  You will see:

	       writing register number 18: I/O error.

Fix:
	RCS file: RCS/sys_process.c,v
	retrieving revision 1.1
	retrieving revision 1.1.1.1
	diff -c -r1.1 -r1.1.1.1
	*** /tmp/,RCSt1026463	Fri Jul  7 16:15:21 1989
	--- /tmp/,RCSt2026463	Fri Jul  7 16:15:22 1989
	***************
	*** 195,202
	  			ipc.ip_data &=  ~PSL_USERCLR;
	  			goto ok;
	  		}
	! 		goto error;
	! 
	  	ok:
	  		*p = ipc.ip_data;
	  		break;
	
	--- 195,206 -----
	  			ipc.ip_data &=  ~PSL_USERCLR;
	  			goto ok;
	  		}
	! 		/* RAY: Allow writes into u.U_FLOAT */
	! 		if ((unsigned) p < (unsigned) &u.U_FLOAT)
	! 			goto error;
	! 		if ((unsigned) p >
	! 		    (unsigned) &u.U_FLOAT + sizeof(u.U_FLOAT) - sizeof(*p))
	! 			goto error;
	  	ok:
	  		*p = ipc.ip_data;
	  		break;