normally give execute permission to memory allocated from the heap
with sbrk.
This also required fixing the smc1 test for amd64 to use mmap to
allocate memory so that it can have execute permission.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4983
sres = VG_(am_mmap_anon_fixed_client)(
anon_start,
anon_size,
- VKI_PROT_READ|VKI_PROT_WRITE|VKI_PROT_EXEC
+ VKI_PROT_READ|VKI_PROT_WRITE
);
vg_assert(!sres.isError);
vg_assert(sres.val == anon_start);
#include <stdio.h>
#include <assert.h>
-#include <malloc.h>
+#include <sys/mman.h>
typedef unsigned long long int Addr;
typedef unsigned char UChar;
int main ( void )
{
int i;
- code = malloc(20);
- assert(code);
+ code = mmap(NULL, 20, PROT_READ|PROT_WRITE|PROT_EXEC,
+ MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
+ assert(code != MAP_FAILED);
for (i = 0; i < 10; i += 2) {
set_dest ( (Addr)&p );
// diversion();
// diversion();
aa(i+1);
}
+ munmap(code, 20);
return 0;
}