Recently, I want to modify the binary program which add a instruction push $rbx
in the binary program. And it will increment the stack by 8 bytes. It sounds good for the binary program.
And I debug the modified binary with gdb, and find that it crashes in movaps
instruction.
1 | movaps xmmword ptr [rsp+0x50], xmm0 |
So what happend?
And I found the answers from some blogs(see reference). movaps
is “move aligned packed single-precision floating-point values”. If the instruction’s operand is memory, the memory address must be aligned to 16 bytes. And I print the $rsp+0x50
, its not 16 bytes alignment. That’s because I pushed $rbx
into the stack and increment the rsp to 8 bytes, and that results in rsp is not aligned to 16 bytes.