aboutsummaryrefslogtreecommitdiff
path: root/src/lib/malloc/map_anon.h
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2019-02-25 08:55:25 -0500
committerNick Mathewson <nickm@torproject.org>2019-02-25 08:55:25 -0500
commit065e7da8e6fdbd9331de8c13344275a8e0fbf32d (patch)
tree063d36265dd691d1e49232358e4267c417d4ed96 /src/lib/malloc/map_anon.h
parent69238ca2da923c8a50d5c1007f3e702eea163b50 (diff)
downloadtor-065e7da8e6fdbd9331de8c13344275a8e0fbf32d.tar.gz
tor-065e7da8e6fdbd9331de8c13344275a8e0fbf32d.zip
Re-enable and fix unit test for nofork mappings
This test was previously written to use the contents of the system headers to decide whether INHERIT_NONE or INHERIT_ZERO was going to work. But that won't work across different environments, such as (for example) when the kernel doesn't match the headers. Instead, we add a testing-only feature to the code to track which of these options actually worked, and verify that it behaved as we expected. Closes ticket 29541; bugfix not on any released version of Tor.
Diffstat (limited to 'src/lib/malloc/map_anon.h')
-rw-r--r--src/lib/malloc/map_anon.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/lib/malloc/map_anon.h b/src/lib/malloc/map_anon.h
index cc5797e4ec..395145bd71 100644
--- a/src/lib/malloc/map_anon.h
+++ b/src/lib/malloc/map_anon.h
@@ -34,4 +34,8 @@
void *tor_mmap_anonymous(size_t sz, unsigned flags);
void tor_munmap_anonymous(void *mapping, size_t sz);
+#ifdef TOR_UNIT_TESTS
+unsigned get_last_anon_map_noinherit(void);
+#endif
+
#endif /* !defined(TOR_MAP_ANON_H) */