Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Sep 2020 21:46:10 +0000 (UTC)
From:      Brooks Davis <brooks@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r365342 - head/libexec/rtld-elf/riscv
Message-ID:  <202009042146.084LkAMJ024893@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202009042146.084LkAMJ024893>