tenderlove / asmrepl

A REPL for x86-64 assembly language
Apache License 2.0
866 stars 33 forks source link

RIP isn't adjusted #5

Closed tenderlove closed 2 years ago

tenderlove commented 2 years ago

ASMREPL works by writing a buffer full of int3 instructions and then letting the other process run. When you write stuff in to the repl, it writes that after the int3 instruction that paused the process. The reason is because I haven't figured out how to adjust RIP in the child process. It means you end up with code that looks like:

int3
mov rax, 0x5
int3
mov rbx, 0x3
int3
add rax, rbx
int3

I'm not sure if you can even adjust RIP on macOS. I'd like to be able to support loops, but with the current setup, loops will pause at every int3.

I'd like to either:

  1. Adjust RIP in the child process, or
  2. Fill in the "used" int3 instructions with nop instructions

Adjusting RIP is ideal, but I'm not sure if it's possible.