summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
authorPablo Ceballos <pceballos@google.com>2016-02-11 18:01:49 -0800
committerThe Android Automerger <android-build@google.com>2016-02-26 16:56:14 -0800
commitb3a9e6d04da503026b33a66f276a7753dcc11a3b (patch)
tree03335f5e8a3c3bad720f8e3614e5e1231f83bbfc /libs
parentdaca8c3407dcc43eeded42d49b4357ff507f27de (diff)
downloadframeworks_native-b3a9e6d04da503026b33a66f276a7753dcc11a3b.zip
frameworks_native-b3a9e6d04da503026b33a66f276a7753dcc11a3b.tar.gz
frameworks_native-b3a9e6d04da503026b33a66f276a7753dcc11a3b.tar.bz2
BQ: Add permission check to BufferQueueConsumer::dump
Bug 27046057 Change-Id: Id7bd8cf95045b497943ea39dde49e877aa6f5c4e
Diffstat (limited to 'libs')
-rw-r--r--libs/gui/BufferQueueConsumer.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/libs/gui/BufferQueueConsumer.cpp b/libs/gui/BufferQueueConsumer.cpp
index bb3e1b0..158eeb4 100644
--- a/libs/gui/BufferQueueConsumer.cpp
+++ b/libs/gui/BufferQueueConsumer.cpp
@@ -26,6 +26,10 @@
#include <gui/IConsumerListener.h>
#include <gui/IProducerListener.h>
+#include <binder/IPCThreadState.h>
+#include <binder/PermissionCache.h>
+#include <private/android_filesystem_config.h>
+
namespace android {
BufferQueueConsumer::BufferQueueConsumer(const sp<BufferQueueCore>& core) :
@@ -572,7 +576,17 @@ sp<NativeHandle> BufferQueueConsumer::getSidebandStream() const {
}
void BufferQueueConsumer::dump(String8& result, const char* prefix) const {
- mCore->dump(result, prefix);
+ 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);
+ } else {
+ mCore->dump(result, prefix);
+ }
}
} // namespace android