BQ: Add permission check to BufferQueueConsumer::dump
Bug 27046057 Change-Id: Id7bd8cf95045b497943ea39dde49e877aa6f5c4e
This commit is contained in:
parent
daca8c3407
commit
b3a9e6d04d
@ -26,6 +26,10 @@
|
|||||||
#include <gui/IConsumerListener.h>
|
#include <gui/IConsumerListener.h>
|
||||||
#include <gui/IProducerListener.h>
|
#include <gui/IProducerListener.h>
|
||||||
|
|
||||||
|
#include <binder/IPCThreadState.h>
|
||||||
|
#include <binder/PermissionCache.h>
|
||||||
|
#include <private/android_filesystem_config.h>
|
||||||
|
|
||||||
namespace android {
|
namespace android {
|
||||||
|
|
||||||
BufferQueueConsumer::BufferQueueConsumer(const sp<BufferQueueCore>& core) :
|
BufferQueueConsumer::BufferQueueConsumer(const sp<BufferQueueCore>& core) :
|
||||||
@ -572,7 +576,17 @@ sp<NativeHandle> BufferQueueConsumer::getSidebandStream() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void BufferQueueConsumer::dump(String8& result, const char* prefix) 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
|
} // namespace android
|
||||||
|
Loading…
Reference in New Issue
Block a user