diff options
author | Brooks Davis <brooks@FreeBSD.org> | 2020-09-04 21:46:10 +0000 |
---|---|---|
committer | Brooks Davis <brooks@FreeBSD.org> | 2020-09-04 21:46:10 +0000 |
commit | 29e1fceb733d3c7986b4286bf99f44b8d0b0821e (patch) | |
tree | 69dba510b8ab5a312fec7d4a6c5634415dcfbc4f /libexec/rtld-elf | |
parent | c86d2ba8a565a774f6f9ab713801e08cc1045c73 (diff) | |
download | src-29e1fceb733d3c7986b4286bf99f44b8d0b0821e.tar.gz src-29e1fceb733d3c7986b4286bf99f44b8d0b0821e.zip |
Maintain a stack alignment of 16-bytes.
This violated the RISC-V 64-bit ABI. On CheriBSD this manifested as
a trap when attempting to store 16-byte aligned types while zeroing
the stack.
Reported by: CHERI, jrtc27
Reviewed by: mhorne, br
Obtained from: CheriBSD
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D26327
Notes
Notes:
svn path=/head/; revision=365342
Diffstat (limited to 'libexec/rtld-elf')
-rw-r--r-- | libexec/rtld-elf/riscv/rtld_start.S | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libexec/rtld-elf/riscv/rtld_start.S b/libexec/rtld-elf/riscv/rtld_start.S index c37cd62e49ec..71806123debc 100644 --- a/libexec/rtld-elf/riscv/rtld_start.S +++ b/libexec/rtld-elf/riscv/rtld_start.S @@ -64,7 +64,8 @@ END(.rtld_start) */ ENTRY(_rtld_bind_start) /* Save the arguments and ra */ - addi sp, sp, -(8 * 17) + /* We require 17 dwords, but the stack must be aligned to 16-bytes */ + addi sp, sp, -(8 * 18) sd a0, (8 * 0)(sp) sd a1, (8 * 1)(sp) sd a2, (8 * 2)(sp) @@ -122,7 +123,7 @@ ENTRY(_rtld_bind_start) fld fa6, (8 * 15)(sp) fld fa7, (8 * 16)(sp) #endif - addi sp, sp, (8 * 17) + addi sp, sp, (8 * 18) /* Call into the correct function */ jr t0 |