1、编译、链接和运行程序
C代码示例:
#include <stdio.h>
#include <stdlib.h>
int main()
{
printf("hello world!\n");
exit(0);
}
编译运行参数如下:
[root@localhost Desktop]# gcc -o hello hello.c
[root@localhost Desktop]# ./hello
2、关闭内存地址随机化机制(alsr)
- 关闭
[root@localhost Desktop]# echo 0 >/proc/sys/kernel/randomize_va_space
- 开启
[root@localhost Desktop]# echo 1 >/proc/sys/kernel/randomize_va_space
C测试示例代码:
#include <stdio.h>
unsigned long sp(void){ asm("mov %rsp, %rax");}
int main(void)
{
unsigned long esp = sp();
printf("Stack pointer (ESP : 0x%lx)\n",esp);
return 0;
}