From owner-svn-src-all@freebsd.org Sun Oct 18 13:23:22 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 884A9A16077; Sun, 18 Oct 2015 13:23:22 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 564F27CC; Sun, 18 Oct 2015 13:23:22 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t9IDNLds072594; Sun, 18 Oct 2015 13:23:21 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t9IDNLCt072593; Sun, 18 Oct 2015 13:23:21 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201510181323.t9IDNLCt072593@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Sun, 18 Oct 2015 13:23:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r289502 - head/sys/arm64/arm64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 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: Sun, 18 Oct 2015 13:23:22 -0000 Author: andrew Date: Sun Oct 18 13:23:21 2015 New Revision: 289502 URL: https://svnweb.freebsd.org/changeset/base/289502 Log: Correctly align the stack. The early csu assumed we passed the aux vector in through the stack pointer, however this may have been misaligned causing some userland applications to crash. A workaround was committed in r284707 where userland would check if the aux vector was passed using the old or new ABI and adjust the stack if needed. As 4 months have passed it is time to move to the new ABI, with the expectation the compat code in csu and the runtime linker to be removed in the future. Sponsored by: ABT Systems Ltd Modified: head/sys/arm64/arm64/machdep.c Modified: head/sys/arm64/arm64/machdep.c ============================================================================== --- head/sys/arm64/arm64/machdep.c Sun Oct 18 12:26:25 2015 (r289501) +++ head/sys/arm64/arm64/machdep.c Sun Oct 18 13:23:21 2015 (r289502) @@ -251,7 +251,13 @@ exec_setregs(struct thread *td, struct i memset(tf, 0, sizeof(struct trapframe)); - tf->tf_sp = stack; + /* + * We need to set x0 for init as it doesn't call + * cpu_set_syscall_retval to copy the value. We also + * need to set td_retval for the cases where we do. + */ + tf->tf_x[0] = td->td_retval[0] = stack; + tf->tf_sp = STACKALIGN(stack); tf->tf_lr = imgp->entry_addr; tf->tf_elr = imgp->entry_addr; }