#include <stdio.h>
// 用 gcc -z execstack 选项编译
int main(void)
{
unsigned char funtest[] = {
0x55,
0x48,0x89,0xe5,
0xb8,0x7b,0x00,0x00,0x00,
0xc9,
0xc3};
int (*fun)(void) = NULL;
fun = (int(*)(void))funtest;
printf("%d\n", fun());
return 0;
}
在x86_64构架 gcc编译。其他平台跑不了