backport: Since x86 psABIs require the function incoming stack must align at 16 bytes...

Backport r265322 from llvm upstream

Since x86 psABIs require the function incoming stack must align at 16
bytes, child process stack passed to clone should be aligned at 16
bytes.

	PR testsuite/70520
	* c-c++-common/asan/clone-test-1.c (main): Align child process
	stack to 16 bytes.

From-SVN: r235790
This commit is contained in:
H.J. Lu 2016-05-02 21:45:34 +00:00 committed by H.J. Lu
parent bc1aee87f6
commit 50d94c29c0
2 changed files with 7 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2016-05-02 H.J. Lu <hongjiu.lu@intel.com>
PR testsuite/70520
* c-c++-common/asan/clone-test-1.c (main): Align child process
stack to 16 bytes.
2016-05-02 David Malcolm <dmalcolm@redhat.com>
PR c++/62314

View File

@ -25,7 +25,7 @@ volatile int zero = 0;
int main(int argc, char **argv) {
int i;
const int kStackSize = 1 << 20;
char child_stack[kStackSize + 1];
char __attribute__((aligned(16))) child_stack[kStackSize + 1];
char *sp = child_stack + kStackSize; /* Stack grows down. */
printf("Parent: %p\n", sp);
pid_t clone_pid = clone(Child, sp, CLONE_FILES | CLONE_VM, NULL, 0, 0, 0);