svn commit: r216231 - head/sys/amd64/amd64

Konstantin Belousov kib at
Mon Dec 6 15:15:28 UTC 2010

Author: kib
Date: Mon Dec  6 15:15:27 2010
New Revision: 216231

  Do not leak %rdx value in the previous image to the new image after
  execve(2). Note that ia32 binaries already handle this properly,
  since ia32_setregs() resets td_retval[1], but not exec_setregs().
  We still do not conform to the amd64 ABI specification, since %rsp
  on the image startup is not aligned to 16 bytes.
  PR:	amd64/124134
  Discussed with:	Petr Salinger <Petr.Salinger seznam cz>
  	(who convinced me that there is indeed several bugs)
  MFC after:	1 week


Modified: head/sys/amd64/amd64/machdep.c
--- head/sys/amd64/amd64/machdep.c	Mon Dec  6 12:18:02 2010	(r216230)
+++ head/sys/amd64/amd64/machdep.c	Mon Dec  6 15:15:27 2010	(r216231)
@@ -876,6 +876,7 @@ exec_setregs(struct thread *td, struct i
 	regs->tf_fs = _ufssel;
 	regs->tf_gs = _ugssel;
 	regs->tf_flags = TF_HASSEGS;
+	td->td_retval[1] = 0;
 	 * Reset the hardware debug registers if they were in use.

More information about the svn-src-all mailing list