• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

frameworks/base


Commit MetaInfo

修订版10c01c2f95f9d7539c0823c83b27c2de681fa99c (tree)
时间2020-10-29 02:55:33
作者John Reck <jreck@goog...>
CommiterKevin Haggerty

Log Message

Add missing isShellUser check

Bug: 160390416
Test: verified command still works from shell

[basilgello: Back-port to 14.1:

- {ROOT,SHELL}_UID -> Process.{ROOT,SHELL}_UID]

Signed-off-by: Vasyl Gello <vasek.gello@gmail.com>

Change-Id: I23bb06e00f1623e4f27c02d7eb2c0d273b40771b
(cherry picked from commit 03542611973e4ce3ddca522ee12bcc85e59ce901)
Merged-In: I23bb06e00f1623e4f27c02d7eb2c0d273b40771b
(cherry picked from commit 5e2931c6569aa8084be9d0690a1ca30534f49c46)
(cherry picked from commit 4a31000e6072c14608ec1c59321481c8aa330313)

更改概述

差异

--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -4306,8 +4306,17 @@ public final class ActivityManagerService extends ActivityManagerNative
43064306 return procState;
43074307 }
43084308
4309+ private boolean isCallerShell() {
4310+ final int callingUid = Binder.getCallingUid();
4311+ return callingUid == Process.SHELL_UID || callingUid == Process.ROOT_UID;
4312+ }
4313+
43094314 @Override
43104315 public boolean setProcessMemoryTrimLevel(String process, int userId, int level) {
4316+ if (!isCallerShell()) {
4317+ EventLog.writeEvent(0x534e4554, 160390416, Binder.getCallingUid(), "");
4318+ throw new SecurityException("Only shell can call it");
4319+ }
43114320 synchronized (this) {
43124321 final ProcessRecord app = findProcessLocked(process, userId, "setProcessMemoryTrimLevel");
43134322 if (app == null) {