[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Patch from rubiate: disable openbsd memory protections in test-memwipe



commit 08d1ac4f2ae81a79d19cbb830c3c88cb2998cb6e
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Thu Sep 8 09:00:24 2016 -0400

    Patch from rubiate: disable openbsd memory protections in test-memwipe
    
    Test-memwipe is *supposed* to invoke undefined behavior, alas.
    
    Closes 20066.
---
 changes/ticket20066     | 5 +++++
 src/test/test-memwipe.c | 6 ++++++
 2 files changed, 11 insertions(+)

diff --git a/changes/ticket20066 b/changes/ticket20066
new file mode 100644
index 0000000..970793d
--- /dev/null
+++ b/changes/ticket20066
@@ -0,0 +1,5 @@
+  o Minor features (testing):
+    - Disable memory protections on OpenBSD when testing memwipe().
+      The test deliberately invokes undefined behaviour which the
+      protections interfere with. Patch from "rubiate". Closes ticket
+      20066.
diff --git a/src/test/test-memwipe.c b/src/test/test-memwipe.c
index 2d40283..8187c45 100644
--- a/src/test/test-memwipe.c
+++ b/src/test/test-memwipe.c
@@ -35,6 +35,12 @@ const char *s = NULL;
     sum += (unsigned char)buf[i];                                       \
   }
 
+#ifdef __OpenBSD__
+/* Disable some of OpenBSD's malloc protections for this test. This helps
+ * us do bad things, such as access freed buffers, without crashing. */
+const char *malloc_options="sufjj";
+#endif
+
 static unsigned
 fill_a_buffer_memset(void)
 {

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits