#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編譯。其他平臺跑不了