As an assignment for a security class, I am trying to use __asm__("jmp 0xbffff994");
in my code, but when I disassemble things in gdb, the instruction is changed to jmp 0xc8047e2a
.
Any idea why and how can I jump to a particular address?
A FAR jump specifies both a segment and offset, which are both absolute in the sense that they specify the required code segment and instruction pointer, rather than an offset relative to the current code segment / instruction pointer.
Description. The jmp instruction transfers execution control to a different point in the instruction stream; records no return information. Jumps with destinations of disp[8|16|32] or r/m[16|32] are near jumps and do not require changes to the segment register value.
JA is used for jumping if the last "flag changing" instruction was on unsigned numbers. but on the other hand, JG is used for jumping if the last "flag changing" instruction was on signed numbers.
Probably because it's a jumping to a relative address, and the linker or loader has moved your code. Try putting the address into a variable, and then do:
jmp dword [var]
or alternatively:
push 0xbffff994
ret
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With