summaryrefslogtreecommitdiff
path: root/libs/binder/IPCThreadState.cpp
diff options
context:
space:
mode:
author Shubang Lu <shubang@google.com> 2021-05-14 23:02:07 +0000
committer Shubang Lu <shubang@google.com> 2021-05-14 23:02:07 +0000
commitdf2e017a4f492478137a27a566c560787017380e (patch)
treec96ba1b1073c7e325efc485ed05aaf310ecb7341 /libs/binder/IPCThreadState.cpp
parent15e2835588ce3a8e318c01230bda2c113a16f761 (diff)
Revert "libbinder: introduce guards for getCalling*"
Revert submission 1707789 Reason for revert: potential cause of b/188228705 Reverted Changes: Id8fc889f4:libbinder: binder RPC - using getCalling* aborts I2145ad0e7:libbinder: introduce guards for getCalling* Change-Id: Id824b7dff55f5cd1a7ac5f2443bd9604fba9fe63
Diffstat (limited to 'libs/binder/IPCThreadState.cpp')
-rw-r--r--libs/binder/IPCThreadState.cpp44
1 files changed, 9 insertions, 35 deletions
diff --git a/libs/binder/IPCThreadState.cpp b/libs/binder/IPCThreadState.cpp
index 18b77e6692..ef7fd44419 100644
--- a/libs/binder/IPCThreadState.cpp
+++ b/libs/binder/IPCThreadState.cpp
@@ -366,45 +366,19 @@ status_t IPCThreadState::clearLastError()
pid_t IPCThreadState::getCallingPid() const
{
- checkContextIsBinderForUse(__func__);
return mCallingPid;
}
const char* IPCThreadState::getCallingSid() const
{
- checkContextIsBinderForUse(__func__);
return mCallingSid;
}
uid_t IPCThreadState::getCallingUid() const
{
- checkContextIsBinderForUse(__func__);
return mCallingUid;
}
-IPCThreadState::SpGuard* IPCThreadState::pushGetCallingSpGuard(SpGuard* guard) {
- SpGuard* orig = mServingStackPointerGuard;
- mServingStackPointerGuard = guard;
- return orig;
-}
-
-void IPCThreadState::restoreGetCallingSpGuard(SpGuard* guard) {
- mServingStackPointerGuard = guard;
-}
-
-void IPCThreadState::checkContextIsBinderForUse(const char* use) const {
- if (mServingStackPointerGuard == nullptr) return;
-
- if (!mServingStackPointer || mServingStackPointerGuard < mServingStackPointer) {
- LOG_ALWAYS_FATAL("In context %s, %s does not make sense.",
- mServingStackPointerGuard->context, use);
- }
-
- // in the case mServingStackPointer is deeper in the stack than the guard,
- // we must be serving a binder transaction (maybe nested). This is a binder
- // context, so we don't abort
-}
-
int64_t IPCThreadState::clearCallingIdentity()
{
// ignore mCallingSid for legacy reasons
@@ -873,15 +847,15 @@ status_t IPCThreadState::clearDeathNotification(int32_t handle, BpBinder* proxy)
}
IPCThreadState::IPCThreadState()
- : mProcess(ProcessState::self()),
- mServingStackPointer(nullptr),
- mServingStackPointerGuard(nullptr),
- mWorkSource(kUnsetWorkSource),
- mPropagateWorkSource(false),
- mIsLooper(false),
- mStrictModePolicy(0),
- mLastTransactionBinderFlags(0),
- mCallRestriction(mProcess->mCallRestriction) {
+ : mProcess(ProcessState::self()),
+ mServingStackPointer(nullptr),
+ mWorkSource(kUnsetWorkSource),
+ mPropagateWorkSource(false),
+ mIsLooper(false),
+ mStrictModePolicy(0),
+ mLastTransactionBinderFlags(0),
+ mCallRestriction(mProcess->mCallRestriction)
+{
pthread_setspecific(gTLS, this);
clearCaller();
mIn.setDataCapacity(256);