Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 6 Dec 2010 15:15:28 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r216231 - head/sys/amd64/amd64
Message-ID:  <201012061515.oB6FFSME036770@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Mon Dec  6 15:15:27 2010
New Revision: 216231
URL: http://svn.freebsd.org/changeset/base/216231

Log:
  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

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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201012061515.oB6FFSME036770>