Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 18 Oct 2015 13:23:21 +0000 (UTC)
From:      Andrew Turner <andrew@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r289502 - head/sys/arm64/arm64
Message-ID:  <201510181323.t9IDNLCt072593@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;
 }



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