diff options
author | Brad Fitzpatrick <bradfitz@android.com> | 2010-08-31 15:06:24 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2010-08-31 15:06:24 -0700 |
commit | f3372f7ca355cbc8828f543937469e313e9500ec (patch) | |
tree | 5e221092fc72811b07297d13a0c13f376d68b519 /libs/binder | |
parent | db0f5623318298290e9d90714dc519c8854ec30d (diff) | |
parent | 985f18ef3ac1d2e6d6aebcf1a819355846e228c2 (diff) | |
download | frameworks_native-f3372f7ca355cbc8828f543937469e313e9500ec.zip frameworks_native-f3372f7ca355cbc8828f543937469e313e9500ec.tar.gz frameworks_native-f3372f7ca355cbc8828f543937469e313e9500ec.tar.bz2 |
am ae087369: am 63070856: Merge "Don\'t propagate StrictMode over one-way Binder calls." into gingerbread
Merge commit 'ae087369c56a270c33c1c1af5be7d3c5d7f94e80'
* commit 'ae087369c56a270c33c1c1af5be7d3c5d7f94e80':
Don't propagate StrictMode over one-way Binder calls.
Diffstat (limited to 'libs/binder')
-rw-r--r-- | libs/binder/IPCThreadState.cpp | 22 | ||||
-rw-r--r-- | libs/binder/Parcel.cpp | 11 |
2 files changed, 27 insertions, 6 deletions
diff --git a/libs/binder/IPCThreadState.cpp b/libs/binder/IPCThreadState.cpp index f6582e6..a3e117f 100644 --- a/libs/binder/IPCThreadState.cpp +++ b/libs/binder/IPCThreadState.cpp @@ -377,6 +377,16 @@ int32_t IPCThreadState::getStrictModePolicy() const return mStrictModePolicy; } +void IPCThreadState::setLastTransactionBinderFlags(int32_t flags) +{ + mLastTransactionBinderFlags = flags; +} + +int32_t IPCThreadState::getLastTransactionBinderFlags() const +{ + return mLastTransactionBinderFlags; +} + void IPCThreadState::restoreCallingIdentity(int64_t token) { mCallingUid = (int)(token>>32); @@ -598,8 +608,10 @@ status_t IPCThreadState::clearDeathNotification(int32_t handle, BpBinder* proxy) } IPCThreadState::IPCThreadState() - : mProcess(ProcessState::self()), mMyThreadId(androidGetTid()), - mStrictModePolicy(0) + : mProcess(ProcessState::self()), + mMyThreadId(androidGetTid()), + mStrictModePolicy(0), + mLastTransactionBinderFlags(0) { pthread_setspecific(gTLS, this); clearCaller(); @@ -983,11 +995,11 @@ status_t IPCThreadState::executeCommand(int32_t cmd) } if (tr.target.ptr) { sp<BBinder> b((BBinder*)tr.cookie); - const status_t error = b->transact(tr.code, buffer, &reply, 0); + const status_t error = b->transact(tr.code, buffer, &reply, tr.flags); if (error < NO_ERROR) reply.setError(error); - + } else { - const status_t error = the_context_object->transact(tr.code, buffer, &reply, 0); + const status_t error = the_context_object->transact(tr.code, buffer, &reply, tr.flags); if (error < NO_ERROR) reply.setError(error); } diff --git a/libs/binder/Parcel.cpp b/libs/binder/Parcel.cpp index 18f75df..f329ac4 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; |