Page MenuHomeFreeBSD

Refactor ptrace() ABI compatibility.
ClosedPublic

Authored by jhb on Jun 9 2020, 3:28 AM.
Tags
None
Referenced Files
Unknown Object (File)
Oct 21 2024, 12:47 PM
Unknown Object (File)
Sep 18 2024, 2:44 AM
Unknown Object (File)
Sep 17 2024, 2:44 PM
Unknown Object (File)
Sep 17 2024, 2:19 PM
Unknown Object (File)
Sep 12 2024, 8:05 PM
Unknown Object (File)
Sep 11 2024, 9:01 PM
Unknown Object (File)
Sep 10 2024, 9:21 PM
Unknown Object (File)
Sep 10 2024, 5:47 PM
Subscribers

Details

Summary

Add a freebsd32_ptrace() and move as many freebsd32 shims as possible
to freebsd32_ptrace(). Aside from register sets, freebsd32 passes
pointers to native structures to kern_ptrace() and converts to/from
native/32-bit structure formats in freebsd32_ptrace() outside of
kern_ptrace().

Test Plan
  • 32-bit ptrace_test (i386) passes when run under an amd64 kernel

Diff Detail

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

Event Timeline

jhb requested review of this revision.Jun 9 2020, 3:28 AM

In CheriBSD in particular we have additional ABIs and this approach is much cleaner by permitting other ABIs to be self-contained when using kern_ptrace().

Would be nice to not include generated bits into review.

Would kern_ptrace() split into two functions, one for prologue and one for the switch() by ops, I suspect it would allow to go a step further and move handling of compat32 PT_{GET,SET}*REGS into freebsd32_ptrace(). Then you can eliminate READ_PROC/WRITE_PROC. This might be tried after this patch lands.

Overall I like it very much.

This revision is now accepted and ready to land.Jun 9 2020, 10:00 AM

My thought on the register sets is to get the register set API fleshed out, and then emulate the older calls in terms of register set operations. The register set handler for NT_FPREGSET, etc. would use the passed in size to determine whether they are populating the 32-bit vs 64-bit register set.

This revision was automatically updated to reflect the committed changes.