Author: kib
Date: Wed Jul 16 08:59:44 2014
New Revision: 268744
URL: http://svnweb.freebsd.org/changeset/base/268744

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/9/sys/amd64/amd64/machdep.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/amd64/amd64/machdep.c
==============================================================================
--- stable/9/sys/amd64/amd64/machdep.c  Wed Jul 16 08:58:38 2014        
(r268743)
+++ stable/9/sys/amd64/amd64/machdep.c  Wed Jul 16 08:59:44 2014        
(r268744)
@@ -1945,7 +1945,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);
 }
 
@@ -2045,8 +2047,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