I am compiling a very basic "hello world" program with gcc, with this command line:
gcc -m32 prog_cible.c -o prog_cible
I am very surprised of the entry point address:
readelf -h prog_cible
...
Entry point: 0x420
I have tunrned off alsr with this command:
echo 0 | sudo tee /proc/sys/kernel/randomize_va_space
I think this cannot be the real entry point. I suppose a base address is added to 0x420 ? In the past, 10 years ago, readelf gave me the good entry point. What has changed since ?
Thanks
You are correct. Your
gccis likely configured to buildPIEbinaries by default.PIEbinary is really a special form of a shared library.If you look at the
typeof the binary (whichreadelf -halso printed), you'll see that it's aDYN, notEXEC.You can disable
PIEwithgcc -m32 -no-pie ..., and then your entry point will look something like0x8048420.