#include #include #include unsigned char mya[] = { 0x50,0x57,0x56,0x52,0xe8, 0x00,0x00,0x00,0x00,0x5e, 0x48,0x81,0xc6,0x24,0x00, 0x00,0x00,0x48,0xc7,0xc0, 0x01,0x00,0x00,0x00,0x48, 0xc7,0xc7,0x01,0x00,0x00, 0x00,0x48,0xc7,0xc2,0x0e, 0x00,0x00,0x00,0x0f,0x05, 0x5a,0x5e,0x5f,0x5a,0xc3, 0x48,0x65,0x6c,0x6c,0x6f, 0x2c,0x20,0x57,0x6f,0x72, 0x6c,0x64,0x21,0x0a,0x00 }; int main(int argc, char**argv) { void *addr = (void*)((unsigned long)mya & ((0UL - 1UL) ^ 0xfff));/*get memory page*/ int ans = mprotect(addr, 1, PROT_READ|PROT_WRITE|PROT_EXEC);/*set page attributes*/ if (ans) { perror("mprotect"); exit(EXIT_FAILURE); } ((void(*)(void))mya)();/*execute array*/ return 0; } ...