summaryrefslogtreecommitdiff
path: root/libs/gui/BufferQueue.cpp
diff options
context:
space:
mode:
author Pablo Ceballos <pceballos@google.com> 2016-02-19 23:54:34 +0000
committer android-build-merger <android-build-merger@google.com> 2016-02-19 23:54:34 +0000
commit1d0e811e5ac853669fe96370e499428049a5b7ee (patch)
treeb496d5ad8e2f826e56308f1943236436ab119e74 /libs/gui/BufferQueue.cpp
parentef6908e2b3e6ee6514620acc338b458ade7c3640 (diff)
parentc2326064136adb834d12c3fed47af5d66cd42c15 (diff)
Merge "DO NOT MERGE BQ: Add permission check to BufferQueueConsumer::dump" into klp-dev
am: c232606413 * commit 'c2326064136adb834d12c3fed47af5d66cd42c15': DO NOT MERGE BQ: Add permission check to BufferQueueConsumer::dump
Diffstat (limited to 'libs/gui/BufferQueue.cpp')
-rw-r--r--libs/gui/BufferQueue.cpp14
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;