commit 8dfc8d7063bf4b317bd47b7a2e8cccb0a428e861
parent a462ca7cce3699f488b5e2f2921738c944cb29c7
Author: David Goulet <dgoulet@torproject.org>
Date: Thu, 30 May 2019 12:58:35 -0400
Merge branch 'tor-github/pr/1057'
Diffstat:
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/changes/bug30629 b/changes/bug30629
@@ -0,0 +1,6 @@
+ o Minor bugfixes (shutdown, libevent, memory safety):
+ - Avoid use-after-free bugs when shutting down, by making sure that we
+ shut down libevent only after shutting down all of its users. We
+ believe these are harmless in practice, since they only occur on the
+ shutdown path, and do not involve any attacker-controlled data. Fixes
+ bug 30629; bugfix on 0.4.1.1-alpha.
diff --git a/src/app/main/shutdown.c b/src/app/main/shutdown.c
@@ -157,10 +157,11 @@ tor_free_all(int postfork)
if (!postfork) {
release_lockfile();
}
- tor_libevent_free_all();
subsystems_shutdown();
+ tor_libevent_free_all();
+
/* Stuff in util.c and address.c*/
if (!postfork) {
esc_router_info(NULL);