diff options
| author | 2016-02-19 23:39:36 +0000 | |
|---|---|---|
| committer | 2016-02-19 23:39:36 +0000 | |
| commit | c2326064136adb834d12c3fed47af5d66cd42c15 (patch) | |
| tree | 127f523b8c93dd982ddf68ab43547704ea53bcaf | |
| parent | 94b0d4e3ab023cfa03a7a4e85f3e09d3743da715 (diff) | |
| parent | 64e357ddf546a069f5c7eaa748de46b7045a6339 (diff) | |
Merge "DO NOT MERGE BQ: Add permission check to BufferQueueConsumer::dump" into klp-dev
| -rw-r--r-- | libs/gui/BufferQueue.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/libs/gui/BufferQueue.cpp b/libs/gui/BufferQueue.cpp index 2aecb67788..5240a61c17 100644 --- a/libs/gui/BufferQueue.cpp +++ b/libs/gui/BufferQueue.cpp @@ -33,6 +33,10 @@ #include <utils/Trace.h> #include <utils/CallStack.h> +#include <binder/IPCThreadState.h> +#include <binder/PermissionCache.h> +#include <private/android_filesystem_config.h> + // Macros for including the BufferQueue name in log messages #define ST_LOGV(x, ...) ALOGV("[%s] "x, mConsumerName.string(), ##__VA_ARGS__) #define ST_LOGD(x, ...) ALOGD("[%s] "x, mConsumerName.string(), ##__VA_ARGS__) @@ -769,6 +773,16 @@ status_t BufferQueue::disconnect(int api) { } void BufferQueue::dump(String8& result, const char* prefix) const { + const IPCThreadState* ipc = IPCThreadState::self(); + const pid_t pid = ipc->getCallingPid(); + const uid_t uid = ipc->getCallingUid(); + if ((uid != AID_SHELL) + && !PermissionCache::checkPermission(String16( + "android.permission.DUMP"), pid, uid)) { + result.appendFormat("Permission Denial: can't dump BufferQueueConsumer " + "from pid=%d, uid=%d\n", pid, uid); + return; + } Mutex::Autolock _l(mMutex); String8 fifo; |