BQ: Add permission check to BufferQueueConsumer::dump
Bug 27046057 Change-Id: Id7bd8cf95045b497943ea39dde49e877aa6f5c4e
This commit is contained in:
parent
6df23e81f7
commit
28a83d4206
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user