summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2020-08-04 23:10:15 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2020-08-04 23:10:15 +0000
commit97f719470b4df8628757738450222cb20e56e0f0 (patch)
treeda416e2c3c8ca2535c1dd2730164fb68d0847078
parent148a4956ebf4842c42137322622ffdd3a25553d5 (diff)
parent2147dc738bcbe00d82c3296f577687576d605b15 (diff)
downloadnative-97f719470b4df8628757738450222cb20e56e0f0.tar.gz
Snap for 6736586 from 2147dc738bcbe00d82c3296f577687576d605b15 to rvc-qpr1-release
Change-Id: I36aa6e7fee5808a9afc61f5e353c7d0a22ee9422
-rw-r--r--services/gpuservice/GpuService.cpp16
-rw-r--r--services/gpuservice/GpuService.h3
2 files changed, 16 insertions, 3 deletions
diff --git a/services/gpuservice/GpuService.cpp b/services/gpuservice/GpuService.cpp
index 304f1d059e..81b0a46e0c 100644
--- a/services/gpuservice/GpuService.cpp
+++ b/services/gpuservice/GpuService.cpp
@@ -63,11 +63,23 @@ void GpuService::setTargetStats(const std::string& appPackageName, const uint64_
}
void GpuService::setUpdatableDriverPath(const std::string& driverPath) {
- developerDriverPath = driverPath;
+ IPCThreadState* ipc = IPCThreadState::self();
+ const int pid = ipc->getCallingPid();
+ const int uid = ipc->getCallingUid();
+
+ // only system_server is allowed to set updatable driver path
+ if (uid != AID_SYSTEM) {
+ ALOGE("Permission Denial: can't set updatable driver path from pid=%d, uid=%d\n", pid, uid);
+ return;
+ }
+
+ std::lock_guard<std::mutex> lock(mLock);
+ mDeveloperDriverPath = driverPath;
}
std::string GpuService::getUpdatableDriverPath() {
- return developerDriverPath;
+ std::lock_guard<std::mutex> lock(mLock);
+ return mDeveloperDriverPath;
}
status_t GpuService::shellCommand(int /*in*/, int out, int err, std::vector<String16>& args) {
diff --git a/services/gpuservice/GpuService.h b/services/gpuservice/GpuService.h
index ba44fe04d4..d1c3aabcce 100644
--- a/services/gpuservice/GpuService.h
+++ b/services/gpuservice/GpuService.h
@@ -75,7 +75,8 @@ private:
* Attributes
*/
std::unique_ptr<GpuStats> mGpuStats;
- std::string developerDriverPath;
+ std::mutex mLock;
+ std::string mDeveloperDriverPath;
};
} // namespace android