Skip to content
Snippets Groups Projects

Ptrace memory reading and floating point registers support

Merged jD91mZM2 requested to merge jD91mZM2/kernel:ptrace-3 into master
1 unresolved thread

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 :laughing:
  • 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

Approval is optional

Merged by Jeremy SollerJeremy Soller 5 years ago (Jul 7, 2019 5:07pm UTC)

Merge details

  • Changes merged into master with cbc892d1 (commits were squashed).
  • Deleted the source branch.

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
149 144 // Unmap kernel
150 145 pti::unmap();
151 146
152 147 // Interrupt return
153 asm!("pop rbx
154 pop fs"
155 : : : : "intel", "volatile");
148 asm!("pop fs" : : : : "intel", "volatile");
149 preserved_pop!();
156 150 scratch_pop!();
157 151 asm!("iretq" : : : : "intel", "volatile");
158 152 }
159 153
160 #[allow(dead_code)]
161 #[repr(packed)]
162 pub struct SyscallStack {
  • jD91mZM2
  • jD91mZM2
  • jD91mZM2 added 1 commit

    added 1 commit

    • 2581c70d - WIP(ptrace): Fix slight bugs

    Compare with previous version

  • merged

  • Jeremy Soller mentioned in commit cbc892d1

    mentioned in commit cbc892d1

  • Please register or sign in to reply