# HG changeset patch
# User Tassilo Philipp
# Date 1490059915 -3600
# Node ID 3999750fae28b80fd316c22381175c86a0d4609f
# Parent  030fbb70aa1b42f89c49706abed3a00504e99fb3
- allocwx changes from last commit mentioned in Changelog and adapted testcode

diff -r 030fbb70aa1b -r 3999750fae28 ChangeLog
--- 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
diff -r 030fbb70aa1b -r 3999750fae28 test/malloc_wx/test_wx.c
--- 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 );
 
diff -r 030fbb70aa1b -r 3999750fae28 test/thunk/test_thunk.c
--- 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");