Summary: | [libc] restarting SYSCALL system call on amd64 loses arguments | ||||||
---|---|---|---|---|---|---|---|
Product: | Base System | Reporter: | rsc | ||||
Component: | kern | Assignee: | Konstantin Belousov <kib> | ||||
Status: | Closed FIXED | ||||||
Severity: | Affects Only Me | ||||||
Priority: | Normal | ||||||
Version: | 9.1-RELEASE | ||||||
Hardware: | Any | ||||||
OS: | Any | ||||||
Attachments: |
|
Description
rsc
2013-09-16 18:20:00 UTC
Author: kib Date: Tue Sep 24 12:24:48 2013 New Revision: 255844 URL: http://svnweb.freebsd.org/changeset/base/255844 Log: 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) Modified: head/sys/amd64/amd64/vm_machdep.c Modified: head/sys/amd64/amd64/vm_machdep.c ============================================================================== --- head/sys/amd64/amd64/vm_machdep.c Tue Sep 24 11:49:04 2013 (r255843) +++ head/sys/amd64/amd64/vm_machdep.c Tue Sep 24 12:24:48 2013 (r255844) @@ -400,9 +400,13 @@ cpu_set_syscall_retval(struct thread *td * 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: _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" Author: kib Date: Fri Sep 27 06:56:58 2013 New Revision: 255905 URL: http://svnweb.freebsd.org/changeset/base/255905 Log: MFC r255844: Ensure that the ERESTART return from the syscall reloads the registers, to make the restarted syscall instruction pass the correct arguments. PR: kern/182161 Modified: stable/9/sys/amd64/amd64/vm_machdep.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/amd64/amd64/vm_machdep.c ============================================================================== --- stable/9/sys/amd64/amd64/vm_machdep.c Thu Sep 26 22:47:02 2013 (r255904) +++ stable/9/sys/amd64/amd64/vm_machdep.c Fri Sep 27 06:56:58 2013 (r255905) @@ -400,9 +400,13 @@ cpu_set_syscall_retval(struct thread *td * 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: _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" Author: kib Date: Fri Sep 27 07:02:48 2013 New Revision: 255906 URL: http://svnweb.freebsd.org/changeset/base/255906 Log: MFC r255844: Ensure that the ERESTART return from the syscall reloads the registers, to make the restarted syscall instruction pass the correct arguments. PR: kern/182161 Modified: stable/8/sys/amd64/amd64/vm_machdep.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/ (props changed) Modified: stable/8/sys/amd64/amd64/vm_machdep.c ============================================================================== --- stable/8/sys/amd64/amd64/vm_machdep.c Fri Sep 27 06:56:58 2013 (r255905) +++ stable/8/sys/amd64/amd64/vm_machdep.c Fri Sep 27 07:02:48 2013 (r255906) @@ -395,9 +395,13 @@ cpu_set_syscall_retval(struct thread *td * 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: _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" State Changed From-To: open->closed Fixed in 10-current, 9-stable and 8-stable. Thanks for the report. Responsible Changed From-To: freebsd-bugs->kib Set responsible to committer. |