Nathan Ringo
Nathan Ringo

Reputation: 1003

Mysterious Segfault

I'm getting a segmentation fault I can't figure out when trying to call a varargs function. In debuggers (both Nemiver/GDB and EDB), the faulty instruction is movaps xmmword ptr [rbp-288], xmm7 and rbp == 0x00007ffd0e16ba78, which is on the stack. xmm7 is 0, if it matters.

The instruction is at .text:00401d10, in the buffer_appendf function.

Online Disassembler

Binary Download

Upvotes: 0

Views: 155

Answers (1)

Jester
Jester

Reputation: 58772

movaps requires 16 byte alignment of the operand, and most calling conventions ensure that. The root cause is that you actually messed up the alignment somewhere earlier, by the look of it it's parallisp_main:

0x0000000000400a95 <+159>:  pop    %rbx
0x0000000000400a96 <+160>:  callq  *%rax
0x0000000000400a98 <+162>:  callq  0x4007e0 <free@plt>
0x0000000000400a9d <+167>:  retq   

Moving the pop %rbx to just before the retq should fix the alignment.

Upvotes: 1

Related Questions