Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 2 Sep 2013 12:04:17 GMT
From:      Robert Watson <rwatson@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 553396 for review
Message-ID:  <201309021204.r82C4Hf0047242@skunkworks.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@553396?ac=10

Change 553396 by rwatson@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)



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