summaryrefslogtreecommitdiff
path: root/simpleperf/cmd_record_test.cpp
diff options
context:
space:
mode:
authorYabin Cui <yabinc@google.com>2021-10-27 10:50:53 -0700
committerYabin Cui <yabinc@google.com>2021-10-27 12:11:29 -0700
commit3485af96c9c1f2978fe9056a4efe097c330c2e5f (patch)
tree93ccd573b7d7e050f15b22b074262237790eb3cb /simpleperf/cmd_record_test.cpp
parent4a90dcfd53e51cdd0279d80d3cdf5ba552adfb91 (diff)
downloadextras-3485af96c9c1f2978fe9056a4efe097c330c2e5f.tar.gz
simpleperf: don't run child command in app uid.
It may allow apps to run unauthorized commands in simpleperf secontext. Bug: 199086135 Test: run CtsSimpleperfTestCases Change-Id: I591d66614c5680af214a31c651330efa1f91e23a
Diffstat (limited to 'simpleperf/cmd_record_test.cpp')
-rw-r--r--simpleperf/cmd_record_test.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/simpleperf/cmd_record_test.cpp b/simpleperf/cmd_record_test.cpp
index 9908c0b5..3e66d0ba 100644
--- a/simpleperf/cmd_record_test.cpp
+++ b/simpleperf/cmd_record_test.cpp
@@ -747,6 +747,10 @@ static void TestRecordingApps(const std::string& app_name, const std::string& ap
it = meta_info.find("app_type");
ASSERT_NE(it, meta_info.end());
ASSERT_EQ(it->second, app_type);
+ reader.reset(nullptr);
+
+ // Check that simpleperf can't execute child command in app uid.
+ ASSERT_FALSE(helper.RecordData("--app " + app_name + " -e " + GetDefaultEvent() + " sleep 1"));
}
TEST(record_cmd, app_option_for_debuggable_app) {