diff options
author | Pablo Ceballos <pceballos@google.com> | 2016-02-11 19:15:35 -0800 |
---|---|---|
committer | Michael Bestas <mikeioannina@cyanogenmod.org> | 2016-04-05 19:08:58 +0300 |
commit | a4bc69d89c2c4bc1d9fe7bab3f695fb7b3bd1116 (patch) | |
tree | 659d691ddc6d8aae8a6d84f8c82ec88fcbb256b2 | |
parent | fbf80e2574d055677b39824aa8dd783411663bbf (diff) | |
download | android_frameworks_native-a4bc69d89c2c4bc1d9fe7bab3f695fb7b3bd1116.tar.gz android_frameworks_native-a4bc69d89c2c4bc1d9fe7bab3f695fb7b3bd1116.tar.bz2 android_frameworks_native-a4bc69d89c2c4bc1d9fe7bab3f695fb7b3bd1116.zip |
DO NOT MERGE BQ: Add permission check to BufferQueueConsumer::dump
Bug 27046057
Change-Id: I387178708f460596433f75bb059854a26cc22e78
(cherry picked from commit 64e357ddf546a069f5c7eaa748de46b7045a6339)
-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 146f53424..c5069d60c 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__) @@ -787,6 +791,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; |