summaryrefslogtreecommitdiff
path: root/libs/binder/Parcel.cpp
diff options
context:
space:
mode:
author Brad Fitzpatrick <bradfitz@android.com> 2010-08-30 16:01:16 -0700
committer Brad Fitzpatrick <bradfitz@android.com> 2010-08-31 13:16:49 -0700
commit5273603e98d2db3bac656b7bcf5352c04c86d62f (patch)
treeae85f89451ef4e278cd237f4a2b28686c2f043c1 /libs/binder/Parcel.cpp
parent00807f5ab9f53c48f05319d8510aa41be0ba6ea7 (diff)
Don't propagate StrictMode over one-way Binder calls.
This was causing stack stitching problems where a one-way call with violations followed by a two-way call without violations was getting the previous one-way call's violation stack stitched on to the second caller's stack. The solution is a little more indirect than I would've liked (preserving the binder's onTransact flags until enforceInterface) but was seemingly necessary to work without changing the AIDL compiler. It should also be sufficiently cheap, since no new calls to thread-local IPCThreadState lookups were required. The additional work is just same-thread getter/setters on the existing IPCThreadState. Change-Id: I4b6db1d445c56e868e6d0d7be3ba6849f4ef23ae
Diffstat (limited to 'libs/binder/Parcel.cpp')
-rw-r--r--libs/binder/Parcel.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/libs/binder/Parcel.cpp b/libs/binder/Parcel.cpp
index 18f75df2ea..f329ac4642 100644
--- a/libs/binder/Parcel.cpp
+++ b/libs/binder/Parcel.cpp
@@ -464,7 +464,16 @@ bool Parcel::enforceInterface(const String16& interface,
if (threadState == NULL) {
threadState = IPCThreadState::self();
}
- threadState->setStrictModePolicy(strictPolicy);
+ if ((threadState->getLastTransactionBinderFlags() &
+ IBinder::FLAG_ONEWAY) != 0) {
+ // For one-way calls, the callee is running entirely
+ // disconnected from the caller, so disable StrictMode entirely.
+ // Not only does disk/network usage not impact the caller, but
+ // there's no way to commuicate back any violations anyway.
+ threadState->setStrictModePolicy(0);
+ } else {
+ threadState->setStrictModePolicy(strictPolicy);
+ }
const String16 str(readString16());
if (str == interface) {
return true;