Author: kib
Date: Wed Jul 16 08:55:53 2014
New Revision: 268742
URL: http://svnweb.freebsd.org/changeset/base/268742

Log:
  MFC r268471:
  For safety, ensure that any consumer of the set_regs() and
  ptrace_set_pc() use the correct return to userspace using iret.

Modified:
  stable/10/sys/amd64/amd64/machdep.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/amd64/amd64/machdep.c
==============================================================================
--- stable/10/sys/amd64/amd64/machdep.c Wed Jul 16 08:52:44 2014        
(r268741)
+++ stable/10/sys/amd64/amd64/machdep.c Wed Jul 16 08:55:53 2014        
(r268742)
@@ -1979,7 +1979,9 @@ makectx(struct trapframe *tf, struct pcb
 int
 ptrace_set_pc(struct thread *td, unsigned long addr)
 {
+
        td->td_frame->tf_rip = addr;
+       set_pcb_flags(td->td_pcb, PCB_FULL_IRET);
        return (0);
 }
 
@@ -2079,8 +2081,8 @@ set_regs(struct thread *td, struct reg *
                tp->tf_fs = regs->r_fs;
                tp->tf_gs = regs->r_gs;
                tp->tf_flags = TF_HASSEGS;
-               set_pcb_flags(td->td_pcb, PCB_FULL_IRET);
        }
+       set_pcb_flags(td->td_pcb, PCB_FULL_IRET);
        return (0);
 }
 
_______________________________________________
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-unsubscr...@freebsd.org"

Reply via email to