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
This commit is contained in:
Brooks Davis 2020-09-04 21:46:10 +00:00
parent c86d2ba8a5
commit 29e1fceb73

View File

@ -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