summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Hridya Valsaraju <hridya@google.com> 2021-04-12 17:11:23 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2021-04-12 17:11:23 +0000
commit369abe010a738a5c5e841cfeac82bd0fca7bfb1c (patch)
tree02c541ba8cdf7f814f853ec0f78c7c5b2fb5d25b
parent1e0ec09f5e3a1a51ad2a9844bc0cd870f364d5f5 (diff)
parent51101604cb4f50e088f15daa06c2f0bd62a532d3 (diff)
Merge "Use ro.product.enforce_debugfs_restrictions to mount/unmount debugfs"
-rw-r--r--cmds/dumpstate/dumpstate.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/cmds/dumpstate/dumpstate.cpp b/cmds/dumpstate/dumpstate.cpp
index 8fd05fb47d..039dbc5bf2 100644
--- a/cmds/dumpstate/dumpstate.cpp
+++ b/cmds/dumpstate/dumpstate.cpp
@@ -2174,14 +2174,13 @@ void Dumpstate::DumpstateBoard(int out_fd) {
}
/*
- * mount debugfs for non-user builds which launch with S and unmount it
- * after invoking dumpstateBoard_* methods. This is to enable debug builds
- * to not have debugfs mounted during runtime. It will also ensure that
- * debugfs is only accessed by the dumpstate HAL.
+ * mount debugfs for non-user builds with ro.product.enforce_debugfs_restrictions
+ * set to true and unmount it after invoking dumpstateBoard_* methods.
+ * This is to enable debug builds to not have debugfs mounted during runtime.
+ * It will also ensure that debugfs is only accessed by the dumpstate HAL.
*/
- auto api_level = android::base::GetIntProperty("ro.product.first_api_level", 0);
- bool mount_debugfs = !PropertiesHelper::IsUserBuild() && api_level >= 31;
-
+ auto mount_debugfs =
+ android::base::GetBoolProperty("ro.product.enforce_debugfs_restrictions", false);
if (mount_debugfs) {
RunCommand("mount debugfs", {"mount", "-t", "debugfs", "debugfs", "/sys/kernel/debug"},
AS_ROOT_20);
@@ -2289,7 +2288,10 @@ void Dumpstate::DumpstateBoard(int out_fd) {
}
if (mount_debugfs) {
- RunCommand("unmount debugfs", {"umount", "/sys/kernel/debug"}, AS_ROOT_20);
+ auto keep_debugfs_mounted =
+ android::base::GetProperty("persist.dbg.keep_debugfs_mounted", "");
+ if (keep_debugfs_mounted.empty())
+ RunCommand("unmount debugfs", {"umount", "/sys/kernel/debug"}, AS_ROOT_20);
}
auto file_sizes = std::make_unique<ssize_t[]>(paths.size());