This is a from a CTF problem I'm working on. Hopefully it's appropriate to ask this question here.

GDB output when segmentation fault happens

Above is the GDB output when the segfault goes off. movaps is the offending instruction, meaning that rsp+0x40 is most likely pointing to unmapped memory.

However, a closer look at the memory allocated for the stack

stack memory map

and rsp=0x00007ffde19d78a8 from the GDB output, shows that rsp+0x40 is well within the allocated bounds. This is really confusing for me, is there something I'm missing here? Something else I can look into to debug this?

Finally the output when running this under strace

[pid 32671] --- SIGSEGV {si_signo=SIGSEGV, si_code=SI_KERNEL, si_addr=NULL} ---
[pid 32671] +++ killed by SIGSEGV (core dumped) +++

shows that it's apparently a null pointer dereference (si_addr=NULL), which doesn't make any sense to me because the offending instruction movaps XMMWORD PTR [rsp+0x40],xmm0 isn't accessing a NULL pointer?


According to this the address should be aligned by 16, which is not happen. Your rsp value is ending by 0xa8, so [rsp + 0x40] will be aligned by 8, not 16.

  • Should've read that 2nd paragraph! Thanks a lot, actually had no idea misalignment could trigger hardware faults, always thought it was just less efficient. – Filip Kilibarda Jun 18 '19 at 8:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.