diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2021-05-23 10:25:10 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2021-05-31 12:03:36 -0700 |
commit | 92a7d1343991897f77afe01041f3b77712445e47 (patch) | |
tree | 8cbf19a1c9670c9e3083f2a86c9af8acf1979d1d /sysdeps/unix/sysv/linux/x86_64/clone.S | |
parent | 271ec55d0ae795f03d92e3aa61bff69a31a19e3a (diff) | |
download | glibc-92a7d1343991897f77afe01041f3b77712445e47.tar glibc-92a7d1343991897f77afe01041f3b77712445e47.tar.gz glibc-92a7d1343991897f77afe01041f3b77712445e47.tar.bz2 glibc-92a7d1343991897f77afe01041f3b77712445e47.zip |
x86-64: Align child stack to 16 bytes [BZ #27902]
In the x86-64 clone wrapper, align child stack to 16 bytes per the
x86-64 psABI.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Diffstat (limited to 'sysdeps/unix/sysv/linux/x86_64/clone.S')
-rw-r--r-- | sysdeps/unix/sysv/linux/x86_64/clone.S | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/sysdeps/unix/sysv/linux/x86_64/clone.S b/sysdeps/unix/sysv/linux/x86_64/clone.S index 31ac12da0c..7418154c4b 100644 --- a/sysdeps/unix/sysv/linux/x86_64/clone.S +++ b/sysdeps/unix/sysv/linux/x86_64/clone.S @@ -54,12 +54,15 @@ ENTRY (__clone) movq $-EINVAL,%rax testq %rdi,%rdi /* no NULL function pointers */ jz SYSCALL_ERROR_LABEL - testq %rsi,%rsi /* no NULL stack pointers */ - jz SYSCALL_ERROR_LABEL + + /* Align stack to 16 bytes per the x86-64 psABI. */ + andq $-16, %rsi + jz SYSCALL_ERROR_LABEL /* no NULL stack pointers */ /* Insert the argument onto the new stack. */ + movq %rcx,-8(%rsi) + subq $16,%rsi - movq %rcx,8(%rsi) /* Save the function pointer. It will be popped off in the child. */ |