PERFORCE change 553396 for review

Robert Watson rwatson at FreeBSD.org
Mon Sep 2 12:04:18 UTC 2013


http://p4web.freebsd.org/@@553396?ac=10

Change 553396 by rwatson at rwatson_cinnamon_macosx on 2013/09/02 12:03:58

	When Philip revised the C run-time code to adjust stack alignment
	for CHERI capabilities, he merged a larger refactoring of assembly
	vs C code for __start().  It looks like a line adjusting the stack
	location was omitted, causing statically linked binaries to
	accidentally overwrite the argv[] pointer array when saving $gp, so
	restore that stack-pointer modification.  This bug caused gcc to
	segfault immediately on start.  I've not spelunked enough to
	understand why dynamically linked binaries worked -- either they use
	a different code path, or something else (less visibly harmful) is
	overwritten in memory instead.

Affected files ...

.. //depot/projects/ctsrd/cheribsd/src/lib/csu/mips/crt1_s.S#2 edit

Differences ...

==== //depot/projects/ctsrd/cheribsd/src/lib/csu/mips/crt1_s.S#2 (text+ko) ====

@@ -57,6 +57,7 @@
 #if defined(__ABICALLS__) && (defined(__mips_o32) || defined(__mips_o64))
 	SETUP_GP
 #endif
+	PTR_ADDU	sp, sp, -CALLFRAME_SIZ
 	REG_S	ra, CALLFRAME_RA(sp)
 #if defined(__ABICALLS__)
 #if defined(__mips_o32) || defined(__mips_o64)


More information about the p4-projects mailing list