changeset 203:3999750fae28

- allocwx changes from last commit mentioned in Changelog and adapted testcode
author Tassilo Philipp
date Tue, 21 Mar 2017 02:31:55 +0100
parents 030fbb70aa1b
children a74e2cd93348
files ChangeLog test/malloc_wx/test_wx.c test/thunk/test_thunk.c
diffstat 3 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Mar 20 23:12:58 2017 +0100
+++ b/ChangeLog	Tue Mar 21 02:31:55 2017 +0100
@@ -16,6 +16,7 @@
   o SPARC32 (v7/v8) support
   o SPARC64 (v9) support
   o POSIX compliance: fallback for wx alloc on systems that don't have mmap()'s MAP_ANON
+  o allocated space used for thunk now always W^X (req. for e.g. OpenBSD >= 6.0)
 general:
   o marked assembly code as not needing an execstack, for safer/easier integration into other
     projects/builds, where needed; this is needed b/c of questionable default behaviours of some
--- a/test/malloc_wx/test_wx.c	Mon Mar 20 23:12:58 2017 +0100
+++ b/test/malloc_wx/test_wx.c	Tue Mar 21 02:31:55 2017 +0100
@@ -37,6 +37,7 @@
   dcTest_initPlatform();
 
   err = dcAllocWX(23, &ptr);
+  if(!err) err = dcInitExecWX(ptr, 23);
   if(!err) dcFreeWX(ptr, 23);
   printf("result: test_alloc_wx: %d\n", (!err) ? 1 : 0 );
 
--- a/test/thunk/test_thunk.c	Mon Mar 20 23:12:58 2017 +0100
+++ b/test/thunk/test_thunk.c	Tue Mar 21 02:31:55 2017 +0100
@@ -98,6 +98,12 @@
     return;
   }
   dcbInitThunk(p, &my_entry);
+  err = dcInitExecWX((void*)p, sizeof(DCThunk));
+  if(err) {
+    dcFreeWX((void*)p, sizeof(DCThunk));
+    printf("0\n");
+    return;
+  }
   fp = (printfun*)p;
   if(setjmp(jbuf) != 0)
     printf("sigsegv\n");