start address of the code segment of the program on x86-64

Valdis.Kletnieks at vt.edu Valdis.Kletnieks at vt.edu
Thu Feb 14 11:55:47 EST 2013


On Thu, 14 Feb 2013 15:33:48 +0200, Kevin Wilson said:
> Hi,
>
> 0x08048000 address is the start address of the code segment of a
> program in on x86-32.

More likely, it was the start address of *one particular run* of the
program.  In most kernel configurations, there's something called Address
Space Layout Randomization (ASLR) that makes the code land at different
places each time, to make it harder to write exploits because you can't
hardcode addresses.

> What is the start address of the code segment of the program  on x86-64 ?
>
> Is there a place in the kernel code where I can add a printk on a
> x86_64 machine to view the code segment
> start ?  How can it be done ?

cat /proc/self/smaps    and ponder for a while.  Try it twice and compare
and see if you can see what ASLR does.

You may also want to think about *why* you want to know where the code
segment starts.  If you know what this address is, what do you plan to
use it for?  (In other words, there's probably a different, easier way
to do whatever it is you're trying to accomplish here)...

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 865 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20130214/a369c204/attachment.bin 


More information about the Kernelnewbies mailing list