Author: brooks
Date: Fri Sep  4 21:46:10 2020
New Revision: 365342
URL: https://svnweb.freebsd.org/changeset/base/365342

Log:
  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

Modified:
  head/libexec/rtld-elf/riscv/rtld_start.S

Modified: head/libexec/rtld-elf/riscv/rtld_start.S
==============================================================================
--- head/libexec/rtld-elf/riscv/rtld_start.S    Fri Sep  4 21:34:47 2020        
(r365341)
+++ head/libexec/rtld-elf/riscv/rtld_start.S    Fri Sep  4 21:46:10 2020        
(r365342)
@@ -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
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to