From owner-svn-src-all@FreeBSD.ORG Mon Dec 6 15:15:28 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 38BF6106566C; Mon, 6 Dec 2010 15:15:28 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 272968FC1A; Mon, 6 Dec 2010 15:15:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oB6FFSmb036772; Mon, 6 Dec 2010 15:15:28 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oB6FFSME036770; Mon, 6 Dec 2010 15:15:28 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201012061515.oB6FFSME036770@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 6 Dec 2010 15:15:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r216231 - head/sys/amd64/amd64 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Dec 2010 15:15:28 -0000 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 (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.