From 7732a091e496da763142d45cea78cad432369e5d Mon Sep 17 00:00:00 2001 From: Steven Moreland Date: Wed, 2 Jan 2019 17:54:16 -0800 Subject: Allow error/abort for non-oneway calls. Low-level processes like init might not want to make blocking calls. This provides the mechanism to programmatically enforce that. Test: enable ERROR_BLOCKING on process and look at callstacks Bug: 36424585 Change-Id: I6dad33271108768f8bfc4723bf3eeddbf9720395 (cherry picked from commit b7412b0d15e5e5625c63cc2aacba72a692594837) --- libs/binder/ProcessState.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'libs/binder/ProcessState.cpp') diff --git a/libs/binder/ProcessState.cpp b/libs/binder/ProcessState.cpp index 53f8dddfe1..3798b61ab9 100644 --- a/libs/binder/ProcessState.cpp +++ b/libs/binder/ProcessState.cpp @@ -234,6 +234,12 @@ ssize_t ProcessState::getKernelReferences(size_t buf_count, uintptr_t* buf) return count; } +void ProcessState::setCallRestriction(CallRestriction restriction) { + LOG_ALWAYS_FATAL_IF(IPCThreadState::selfOrNull(), "Call restrictions must be set before the threadpool is started."); + + mCallRestriction = restriction; +} + ProcessState::handle_entry* ProcessState::lookupHandleLocked(int32_t handle) { const size_t N=mHandleToObject.size(); @@ -426,6 +432,7 @@ ProcessState::ProcessState(const char *driver) , mBinderContextUserData(nullptr) , mThreadPoolStarted(false) , mThreadPoolSeq(1) + , mCallRestriction(CallRestriction::NONE) { if (mDriverFD >= 0) { // mmap the binder, providing a chunk of virtual address space to receive transactions. -- cgit v1.2.3-59-g8ed1b