Uhh what?
Uhh what?
Posted Oct 8, 2024 18:30 UTC (Tue) by daroc (editor, #160859)In reply to: Uhh what? by NYKevin
Parent article: Efficient Rust tracepoints
What exactly is required for a tracepoint depends on architecture — and in particular, the details of how the instruction decoder synchronizes with memory — but for x86_64, just a sequence of nops is not enough, it needs to be one single nop of the right size (and aligned, if I recall correctly). Otherwise, you can end up executing part of the jump target as though it was an instruction, if the instruction pointer is inside the sequence of nops when the replacement happens.
Luckily, x86_64 has nops of every size up to ... 12, I think it was? So in practice, you just need to make sure you choose the right size nop.