summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Steven Moreland <smoreland@google.com> 2020-02-18 16:41:21 -0800
committer Steven Moreland <smoreland@google.com> 2020-02-19 01:03:47 +0000
commit7c0edebd0f1e538b7dc5872719a8ff1f549a1fbb (patch)
tree26789a91e837cc448a222e1fb1c1bd030f1a7c3d
parentf2a15e8742cf33e37e6c96f4731c298c6749bb68 (diff)
libbinder: Do not destruct TextOutput
Recent changes meant that a log is more likely during process shutdown, given certain races w/ alog. However, this should have still been possible before. Allocating TextOutput objects on the heap to avoid them getting destructed. Fixes: 149516130 Test: while ! cmd activity get-current-user 2>&1 | grep FORTIFY; do :; done Change-Id: Ie5c066172203172a80c135ad5aa7da09b362ee73
-rw-r--r--libs/binder/Static.cpp10
1 files changed, 3 insertions, 7 deletions
diff --git a/libs/binder/Static.cpp b/libs/binder/Static.cpp
index 7a77f6de54..779ed412ba 100644
--- a/libs/binder/Static.cpp
+++ b/libs/binder/Static.cpp
@@ -64,13 +64,9 @@ private:
int mFD;
};
-static LogTextOutput gLogTextOutput;
-static FdTextOutput gStdoutTextOutput(STDOUT_FILENO);
-static FdTextOutput gStderrTextOutput(STDERR_FILENO);
-
-TextOutput& alog(gLogTextOutput);
-TextOutput& aout(gStdoutTextOutput);
-TextOutput& aerr(gStderrTextOutput);
+TextOutput& alog(*new LogTextOutput());
+TextOutput& aout(*new FdTextOutput(STDOUT_FILENO));
+TextOutput& aerr(*new FdTextOutput(STDERR_FILENO));
// ------------ ProcessState.cpp