Page MenuHomeFreeBSD

powerpc: Only worry about the lower 32 bits of SP in a 32-bit process
ClosedPublic

Authored by jhibbits on Jul 9 2019, 10:00 PM.

Details

Summary

Running a 32-bit process on a 64-bit POWER CPU may still use all 64-bits
in calculations, while ignoring the upper 32 bits for addressing
storage. It so happens that some processes end up with r1 (SP) having
bit 31 set in some cases (33-bit address). Writing out to this 33-bit
address obviosly fails. Since the CPU ignores the upper bits, we should
as well.

sendsig() and cpu_fetch_syscall_args() appear to be the only functions
that actually rely on userspace register values for copy in/out, and
cpu_fetch_syscall_args() doesn't seem to be bitten in practice yet.

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

jhibbits created this revision.Jul 9 2019, 10:00 PM
luporl accepted this revision.Jul 10 2019, 1:48 PM

Nice catch!

This revision is now accepted and ready to land.Jul 10 2019, 1:48 PM