init: log when 'user' is unspecified
NOTE: in master, but should be submitted in AOSP.
Waiting to hear from security folks. Also might
need cleanup.
Not currently done. Seems errorprone.
Bug: 276813155
Test: boot, check logs
Change-Id: I7cbc39b282889dd582f06a8eedc38ae637c8edec
diff --git a/init/service_parser.cpp b/init/service_parser.cpp
index 3563084..d89664c 100644
--- a/init/service_parser.cpp
+++ b/init/service_parser.cpp
@@ -534,7 +534,7 @@
if (!uid.ok()) {
return Error() << "Unable to find UID for '" << args[1] << "': " << uid.error();
}
- service_->proc_attr_.uid = *uid;
+ service_->proc_attr_.parsed_uid = *uid;
return {};
}
@@ -677,6 +677,11 @@
return {};
}
+ if (service_->proc_attr_.parsed_uid == std::nullopt) {
+ LOG(WARNING) << "No user specified for service '" << service_->name()
+ << "'. Defaults to root.";
+ }
+
if (interface_inheritance_hierarchy_) {
if (const auto& check_hierarchy_result = CheckInterfaceInheritanceHierarchy(
service_->interfaces(), *interface_inheritance_hierarchy_);