Browse files

Ensure that the ERESTART return from the syscall reloads the

registers, to make the restarted syscall instruction pass the correct
arguments.

PR:	kern/182161
Reported by:	Russ Cox <rsc@swtch.com>
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Approved by:	re (marius)
  • Loading branch information...
1 parent 1f2c9d2 commit 2346155b1e1ec03137ae64ce08cfe2d7803df47e @kostikbel kostikbel committed Sep 24, 2013
Showing with 4 additions and 0 deletions.
  1. +4 −0 sys/amd64/amd64/vm_machdep.c
View
4 sys/amd64/amd64/vm_machdep.c
@@ -400,9 +400,13 @@ cpu_set_syscall_retval(struct thread *td, int error)
* for the next iteration.
* %r10 restore is only required for freebsd/amd64 processes,
* but shall be innocent for any ia32 ABI.
+ *
+ * Require full context restore to get the arguments
+ * in the registers reloaded at return to usermode.
*/
td->td_frame->tf_rip -= td->td_frame->tf_err;
td->td_frame->tf_r10 = td->td_frame->tf_rcx;
+ set_pcb_flags(td->td_pcb, PCB_FULL_IRET);
break;
case EJUSTRETURN:

0 comments on commit 2346155

Please sign in to comment.