开发者

Isn't the start address of the stack fixed in linux?

开发者 https://www.devze.com 2023-02-25 21:40 出处:网络
unsigned long find_start(void){ __asm__("movq %rsp, %rax"); } int main(){ printf ("OX%x\\n" , find_start()) ;
unsigned long find_start(void){
    __asm__("movq %rsp, %rax");
}
int main(){
    printf ("OX%x\n" , find_start()) ;
}

This is a further question of my previous one,

the output is different each time I run the programe.

isn't the start address of the stack fixed in linux?

The kernel version is 2.6.18-194.el5

Update from comments: I'm now tryi开发者_Go百科ng to do a hello world exploit,how to overcome this?Will the process created by execve be using the same stack start address as its parent process?


Perhaps you're seeing the effect of address space layout randomization. It's a security feature, to make it harder to exploit stack or buffer overruns.


See Pseudo-random stack pointer under Linux?


How would that be possible on an operating system that supports multiple processes and multiple threads?

EDIT: I should mention what I brought up in the comments: Address Space Layout Randomization, a security feature that deliberately scrambles the address around.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号