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) _______________________________________________ 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"