Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 May 2020 02:27:11 +0000 (UTC)
From:      Brandon Bergren <bdragon@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r361493 - head/sys/powerpc/powerpc
Message-ID:  <202005260227.04Q2RB6g062807@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bdragon
Date: Tue May 26 02:27:10 2020
New Revision: 361493
URL: https://svnweb.freebsd.org/changeset/base/361493

Log:
  [PowerPC] Ensure ppc32 cpu_switch routines set up Secure-PLT.
  
  This is a correctness fix needed to enable the ifunc conversion of the pmap
  in D24993.
  
  Since we are making function calls that may need to go through the PLT, ensure
  r30 is set up correctly.
  
  This fixes crashes when booting with D24993 applied.
  
  Reviewed by:	jhibbits (in IRC)
  Sponsored by:	Tag1 Consulting, Inc.

Modified:
  head/sys/powerpc/powerpc/swtch32.S

Modified: head/sys/powerpc/powerpc/swtch32.S
==============================================================================
--- head/sys/powerpc/powerpc/swtch32.S	Mon May 25 23:49:46 2020	(r361492)
+++ head/sys/powerpc/powerpc/swtch32.S	Tue May 26 02:27:10 2020	(r361493)
@@ -92,6 +92,11 @@ ENTRY(cpu_switch)
 	mflr	%r16			/* Save the link register */
 	stw	%r16,PCB_LR(%r6)
 	stw	%r1,PCB_SP(%r6)		/* Save the stack pointer */
+	bl	1f
+1:
+	mflr	%r30			/* Prepare for secure-PLT calls */
+	addis	%r30, %r30, (_GLOBAL_OFFSET_TABLE_-1b)@ha
+	addi	%r30, %r30, (_GLOBAL_OFFSET_TABLE_-1b)@l
 
 	mr	%r14,%r3		/* Copy the old thread ptr... */
 	mr	%r2,%r4			/* and the new thread ptr in curthread */
@@ -129,6 +134,7 @@ cpu_switchin:
 	mflr	%r6
 	addis	%r6,%r6,(_GLOBAL_OFFSET_TABLE_-1b)@ha
 	addi	%r6,%r6,(_GLOBAL_OFFSET_TABLE_-1b)@l
+	mr	%r30, %r6		/* Prepare for secure-PLT calls */
 	lwz	%r6,blocked_lock@got(%r6)
 blocked_loop:
 	lwz	%r7,TD_LOCK(%r2)



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