Page MenuHomeFreeBSD

rtld/powerpc: Fix _rtld_bind_start for powerpcspe
ClosedPublic

Authored by jhibbits on Nov 23 2019, 5:22 PM.
Tags
None
Referenced Files
F103230574: D22520.id64766.diff
Fri, Nov 22, 11:10 AM
Unknown Object (File)
Sep 24 2024, 4:40 AM
Unknown Object (File)
Sep 20 2024, 10:15 PM
Unknown Object (File)
Sep 20 2024, 9:11 PM
Unknown Object (File)
Sep 18 2024, 6:49 AM
Unknown Object (File)
Sep 4 2024, 4:33 AM
Unknown Object (File)
Sep 2 2024, 4:02 PM
Unknown Object (File)
Sep 1 2024, 8:33 PM
Subscribers

Details

Summary

We need to save off the full 64-bit register, not just the low 32 bits,
of all registers getting saved off in _rtld_bind_start. Additionally,
we need to save off the other SPE registers (SPEFSCR and accumulator),
so that their program state is not affected by the PLT resolver.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

libexec/rtld-elf/powerpc/rtld_start.S
114 ↗(On Diff #64766)

Comment is outdated now.

Maybe something like

/* stack space for r0, r3-r31 and nonvolatile SPRs + callee save area */

126 ↗(On Diff #64766)

same here. Probably don't need to duplicate the comment either since it's now obvious what it's doing.

libexec/rtld-elf/powerpc/rtld_start.S
110 ↗(On Diff #64766)

We're now allocating 20 bytes less stack than the original code in the !SPE case. Your math looks more correct to me though, so the original -160 must have been wrong.

jhibbits added inline comments.
libexec/rtld-elf/powerpc/rtld_start.S
110 ↗(On Diff #64766)

Yes, it was overkill, but not detrimental.

I just confirmed it still works on powerpc, nothing broke.

Attempts to theorize on reduction of scope of this have failed, apparently we do in fact need to be backing this much up when calling the resolver.

I think this is about as nice as we're gonna get it.

This revision is now accepted and ready to land.Nov 24 2019, 4:19 AM
This revision was automatically updated to reflect the committed changes.