svn commit: r239947 - stable/9/sys/amd64/amd64

Konstantin Belousov kib at FreeBSD.org
Fri Aug 31 12:04:30 UTC 2012


Author: kib
Date: Fri Aug 31 12:04:29 2012
New Revision: 239947
URL: http://svn.freebsd.org/changeset/base/239947

Log:
  MFC r238669:
  Force clean FPU state in PCB user FPU save area by performing
  getfpuregs(9) before accessing user FPU save area in ptrace_machdep.c
  for PT_I386_{GET,SET}XMMREGS and PT_{GET,SET}XSTATE.

Modified:
  stable/9/sys/amd64/amd64/ptrace_machdep.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/amd64/amd64/ptrace_machdep.c
==============================================================================
--- stable/9/sys/amd64/amd64/ptrace_machdep.c	Fri Aug 31 12:01:35 2012	(r239946)
+++ stable/9/sys/amd64/amd64/ptrace_machdep.c	Fri Aug 31 12:04:29 2012	(r239947)
@@ -50,6 +50,7 @@ cpu_ptrace_xstate(struct thread *td, int
 
 	switch (req) {
 	case PT_GETXSTATE:
+		fpugetregs(td);
 		savefpu = (char *)(get_pcb_user_save_td(td) + 1);
 		error = copyout(savefpu, addr,
 		    cpu_max_ext_state_size - sizeof(struct savefpu));
@@ -62,8 +63,10 @@ cpu_ptrace_xstate(struct thread *td, int
 		}
 		savefpu = malloc(data, M_TEMP, M_WAITOK);
 		error = copyin(addr, savefpu, data);
-		if (error == 0)
+		if (error == 0) {
+			fpugetregs(td);
 			error = fpusetxstate(td, savefpu, data);
+		}
 		free(savefpu, M_TEMP);
 		break;
 
@@ -89,11 +92,13 @@ cpu32_ptrace(struct thread *td, int req,
 
 	switch (req) {
 	case PT_I386_GETXMMREGS:
+		fpugetregs(td);
 		error = copyout(get_pcb_user_save_td(td), addr,
 		    sizeof(*fpstate));
 		break;
 
 	case PT_I386_SETXMMREGS:
+		fpugetregs(td);
 		fpstate = get_pcb_user_save_td(td);
 		error = copyin(addr, fpstate, sizeof(*fpstate));
 		fpstate->sv_env.en_mxcsr &= cpu_mxcsr_mask;


More information about the svn-src-stable mailing list