Hi, I've written this program to try a shellcode made by me:
char shell[] = "\xeb\x25\x5e\xb8\x46\x00\x00\x00" "\xbb\x00\x00\x00\x00\xb9\x00\x00" "\x00\x00\xcd\x80\xb8\x0b\x00\x00" "\x00\x89\xf3\x6a\x00\x56\x89\xe4" "\xba\x00\x00\x00\x00\xcd\x80\xe8" "\xd6\xff\xff\xff" "/bin/sh"; main() { printf ("%p\n",shell); __asm__("call 0x08049600"); } Where, of course, 0x08049600 is the address of my shellcode. But when I compile and run the program I get a segmentation fault. This is what I get disassembling the program with Gdb: 0x080483a4 <main+0>: push %ebp 0x080483a5 <main+1>: mov %esp,%ebp 0x080483a7 <main+3>: sub $0x8,%esp 0x080483aa <main+6>: and $0xfffffff0,%esp 0x080483ad <main+9>: mov $0x0,%eax 0x080483b2 <main+14>: add $0xf,%eax 0x080483b5 <main+17>: add $0xf,%eax 0x080483b8 <main+20>: shr $0x4,%eax 0x080483bb <main+23>: shl $0x4,%eax 0x080483be <main+26>: sub %eax,%esp 0x080483c0 <main+28>: sub $0x8,%esp 0x080483c3 <main+31>: push $0x8049600 0x080483c8 <main+36>: push $0x80484e4 0x080483cd <main+41>: call 0x80482b8 <[EMAIL PROTECTED]> 0x080483d2 <main+46>: add $0x10,%esp 0x080483d5 <main+49>: call 0x4 0x080483da <main+54>: leave 0x080483db <main+55>: ret Why do I have a call 0x4 on main+49 instead of call 0x08049600? -- Summary: Problem with call directive in inline ASM Product: gcc Version: 3.4.6 Status: UNCONFIRMED Severity: normal Priority: P3 Component: inline-asm AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: blacklight86 at gmail dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30002