Page MenuHomeFreeBSD

Refactor ptrace() ABI compatibility.
ClosedPublic

Authored by jhb on Jun 9 2020, 3:28 AM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Jun 25, 10:55 AM
Unknown Object (File)
Feb 8 2024, 12:38 PM
Unknown Object (File)
Dec 20 2023, 8:11 AM
Unknown Object (File)
Nov 19 2023, 2:47 PM
Unknown Object (File)
Nov 19 2023, 1:17 PM
Unknown Object (File)
Sep 14 2023, 4:04 AM
Unknown Object (File)
Aug 4 2023, 4:03 PM
Unknown Object (File)
Aug 4 2023, 4:02 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.