Skip to content

Ptrace memory reading and floating point registers support

jD91mZM2 requested to merge jD91mZM2/kernel:ptrace-3 into master

To be merged together with syscall!37 (merged).

There are still some important aspects of ptrace to be considered, but I would like to get the complete feature out first, in hopes that I can get some help testing it. It's important that no release is made before the final concerns of either this PR or the last one are addressed though, as some concerns are security and stability related.

Overview of changes:

  • The debug handler has been reworked to be cleaner. I'm not sure if performance changes for the better or for the worse by not doing a "dryrun" first, but in hindsight I think the dryrun was a bad idea that just caused more overhead. Either way this interrupt should not be called too often, maybe never if not using ptrace.
  • The breakpoint handler has been configured as permitted for use by int 3 and int3, previously it would send a General Protection Fault, something I pulled out my hair over before reading about interrupt permissions 😆
  • All "preserved" registers always are pushed. It's unfortunate, but it's a necessary evil as we've already agreed to. The proc scheme needs access to these registers.
  • proc: now gives access to rsp. Behavior when interrupt is called from the same privilege ring is sadly untested for now.
  • proc: now blocks access to writing rip, cs, and rflags. I'm not sure yet how linux handles this.

Merge request reports