This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug inline-asm/30002] Problem with call directive in inline ASM



------- Comment #2 from blacklight86 at gmail dot com  2006-11-28 13:48 -------
This is what I do and what I get:

blacklight@nightmare:~/prog/shell$ gcc -o vuln vuln.c
blacklight@nightmare:~/prog/shell$ ./vuln
0x8049600
Segmentation fault

Where 0x8049600 is the address of my shellcode, obtained this way:

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 0x8049600");
}

So I'm quite sure 0x8049600 is the REAL address of my shellcode. I guessed it's
a linker problem...but why? The reference in the call it's quite accurate I
think...


-- 

blacklight86 at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30002


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]