Index: config/auto/frames/test_exec_linux_c.in =================================================================== --- config/auto/frames/test_exec_linux_c.in (revision 41635) +++ config/auto/frames/test_exec_linux_c.in (working copy) @@ -7,6 +7,7 @@ #include #include +#include #include #include #include @@ -36,7 +37,7 @@ pf t; char *p; int rc; - int prot = PROT_READ; + int prot = PROT_READ | PROT_WRITE; if (argc != 2) { fprintf(stderr, "usage: test 0 | 1\n"); @@ -45,15 +46,14 @@ if (atoi(argv[1])) prot |= PROT_EXEC; - p = memalign(PAGE_SIZE, sizeof (code)); + p = mmap(NULL, PAGE_SIZE, prot, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0); + if (!p) { + perror("mmap failed\n"); + exit(1); + } + memcpy(p, code, sizeof (code)); t = (pf) p; - rc = mprotect(p, PAGE_SIZE, prot); - if (rc) { - fprintf(stderr, "p = %p PAGE_SIZE = %d (0x%x)\n", p, - PAGE_SIZE, PAGE_SIZE); - perror("failure"); - } if (t() == 1) puts("ok");