init: remove interface checks from init
HIDL interface checks are done by host_init_verifier at build-time. Bug: 326827772 Test: mmma system/core/init Change-Id: I18e9590aba614bebfdbc6aa8bca7036821a6c4f3
This commit is contained in:
parent
95c4242cf6
commit
d51fb54d56
9 changed files with 13 additions and 57 deletions
|
|
@ -38,7 +38,6 @@ init_common_sources = [
|
|||
"capabilities.cpp",
|
||||
"epoll.cpp",
|
||||
"import_parser.cpp",
|
||||
"interface_utils.cpp",
|
||||
"interprocess_fifo.cpp",
|
||||
"keychords.cpp",
|
||||
"parser.cpp",
|
||||
|
|
@ -88,6 +87,7 @@ init_device_sources = [
|
|||
init_host_sources = [
|
||||
"check_builtins.cpp",
|
||||
"host_import_parser.cpp",
|
||||
"interface_utils.cpp",
|
||||
]
|
||||
|
||||
soong_config_module_type {
|
||||
|
|
@ -190,7 +190,6 @@ libinit_cc_defaults {
|
|||
"libext4_utils",
|
||||
"libfs_mgr",
|
||||
"libgsi",
|
||||
"libhidl-gen-utils",
|
||||
"liblog",
|
||||
"liblogwrap",
|
||||
"liblp",
|
||||
|
|
|
|||
|
|
@ -297,8 +297,7 @@ int main(int argc, char** argv) {
|
|||
ActionManager& am = ActionManager::GetInstance();
|
||||
ServiceList& sl = ServiceList::GetInstance();
|
||||
Parser parser;
|
||||
parser.AddSectionParser("service",
|
||||
std::make_unique<ServiceParser>(&sl, GetSubcontext(), std::nullopt));
|
||||
parser.AddSectionParser("service", std::make_unique<ServiceParser>(&sl, GetSubcontext()));
|
||||
parser.AddSectionParser("on", std::make_unique<ActionParser>(&am, GetSubcontext()));
|
||||
parser.AddSectionParser("import", std::make_unique<HostImportParser>());
|
||||
|
||||
|
|
|
|||
|
|
@ -268,8 +268,8 @@ void DumpState() {
|
|||
Parser CreateParser(ActionManager& action_manager, ServiceList& service_list) {
|
||||
Parser parser;
|
||||
|
||||
parser.AddSectionParser("service", std::make_unique<ServiceParser>(
|
||||
&service_list, GetSubcontext(), std::nullopt));
|
||||
parser.AddSectionParser("service",
|
||||
std::make_unique<ServiceParser>(&service_list, GetSubcontext()));
|
||||
parser.AddSectionParser("on", std::make_unique<ActionParser>(&action_manager, GetSubcontext()));
|
||||
parser.AddSectionParser("import", std::make_unique<ImportParser>(&parser));
|
||||
|
||||
|
|
@ -324,9 +324,7 @@ Parser CreateApexConfigParser(ActionManager& action_manager, ServiceList& servic
|
|||
}
|
||||
}
|
||||
#endif // RECOVERY
|
||||
parser.AddSectionParser("service",
|
||||
std::make_unique<ServiceParser>(&service_list, subcontext,
|
||||
std::nullopt));
|
||||
parser.AddSectionParser("service", std::make_unique<ServiceParser>(&service_list, subcontext));
|
||||
parser.AddSectionParser("on", std::make_unique<ActionParser>(&action_manager, subcontext));
|
||||
|
||||
return parser;
|
||||
|
|
|
|||
|
|
@ -62,8 +62,7 @@ void TestInit(const std::string& init_script_file, const BuiltinFunctionMap& tes
|
|||
Action::set_function_map(&test_function_map);
|
||||
|
||||
Parser parser;
|
||||
parser.AddSectionParser("service",
|
||||
std::make_unique<ServiceParser>(service_list, nullptr, std::nullopt));
|
||||
parser.AddSectionParser("service", std::make_unique<ServiceParser>(service_list, nullptr));
|
||||
parser.AddSectionParser("on", std::make_unique<ActionParser>(action_manager, nullptr));
|
||||
parser.AddSectionParser("import", std::make_unique<ImportParser>(&parser));
|
||||
|
||||
|
|
@ -625,8 +624,7 @@ service A something
|
|||
|
||||
ServiceList service_list;
|
||||
Parser parser;
|
||||
parser.AddSectionParser("service",
|
||||
std::make_unique<ServiceParser>(&service_list, nullptr, std::nullopt));
|
||||
parser.AddSectionParser("service", std::make_unique<ServiceParser>(&service_list, nullptr));
|
||||
|
||||
ASSERT_TRUE(parser.ParseConfig(tf.path));
|
||||
|
||||
|
|
@ -657,8 +655,7 @@ service A something
|
|||
|
||||
ServiceList service_list;
|
||||
Parser parser;
|
||||
parser.AddSectionParser("service",
|
||||
std::make_unique<ServiceParser>(&service_list, nullptr, std::nullopt));
|
||||
parser.AddSectionParser("service", std::make_unique<ServiceParser>(&service_list, nullptr));
|
||||
|
||||
ASSERT_TRUE(parser.ParseConfig(tf.path));
|
||||
ASSERT_EQ(1u, parser.parse_error_count());
|
||||
|
|
|
|||
|
|
@ -103,8 +103,7 @@ service $name /system/bin/yes
|
|||
"$selabel", GetSecurityContext(), false);
|
||||
ServiceList& service_list = ServiceList::GetInstance();
|
||||
Parser parser;
|
||||
parser.AddSectionParser("service",
|
||||
std::make_unique<ServiceParser>(&service_list, nullptr, std::nullopt));
|
||||
parser.AddSectionParser("service", std::make_unique<ServiceParser>(&service_list, nullptr));
|
||||
|
||||
TemporaryFile tf;
|
||||
ASSERT_TRUE(tf.fd != -1);
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@
|
|||
#include <android-base/parseint.h>
|
||||
#include <android-base/properties.h>
|
||||
#include <android-base/strings.h>
|
||||
#include <hidl-util/FQName.h>
|
||||
#include <processgroup/processgroup.h>
|
||||
#include <system/thread_defs.h>
|
||||
|
||||
|
|
@ -201,24 +200,6 @@ Result<void> ServiceParser::ParsePriority(std::vector<std::string>&& args) {
|
|||
Result<void> ServiceParser::ParseInterface(std::vector<std::string>&& args) {
|
||||
const std::string& interface_name = args[1];
|
||||
const std::string& instance_name = args[2];
|
||||
|
||||
// AIDL services don't use fully qualified names and instead just use "interface aidl <name>"
|
||||
if (interface_name != "aidl") {
|
||||
FQName fq_name;
|
||||
if (!FQName::parse(interface_name, &fq_name)) {
|
||||
return Error() << "Invalid fully-qualified name for interface '" << interface_name
|
||||
<< "'";
|
||||
}
|
||||
|
||||
if (!fq_name.isFullyQualified()) {
|
||||
return Error() << "Interface name not fully-qualified '" << interface_name << "'";
|
||||
}
|
||||
|
||||
if (fq_name.isValidValueName()) {
|
||||
return Error() << "Interface name must not be a value name '" << interface_name << "'";
|
||||
}
|
||||
}
|
||||
|
||||
const std::string fullname = interface_name + "/" + instance_name;
|
||||
|
||||
for (const auto& svc : *service_list_) {
|
||||
|
|
@ -702,14 +683,6 @@ Result<void> ServiceParser::EndSection() {
|
|||
}
|
||||
}
|
||||
|
||||
if (interface_inheritance_hierarchy_) {
|
||||
if (const auto& check_hierarchy_result = CheckInterfaceInheritanceHierarchy(
|
||||
service_->interfaces(), *interface_inheritance_hierarchy_);
|
||||
!check_hierarchy_result.ok()) {
|
||||
return Error() << check_hierarchy_result.error();
|
||||
}
|
||||
}
|
||||
|
||||
if (SelinuxGetVendorAndroidVersion() >= __ANDROID_API_R__) {
|
||||
if ((service_->flags() & SVC_CRITICAL) != 0 && (service_->flags() & SVC_ONESHOT) != 0) {
|
||||
return Error() << "service '" << service_->name()
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
|
||||
#include <vector>
|
||||
|
||||
#include "interface_utils.h"
|
||||
#include "parser.h"
|
||||
#include "service.h"
|
||||
#include "service_list.h"
|
||||
|
|
@ -29,13 +28,8 @@ namespace init {
|
|||
|
||||
class ServiceParser : public SectionParser {
|
||||
public:
|
||||
ServiceParser(
|
||||
ServiceList* service_list, Subcontext* subcontext,
|
||||
const std::optional<InterfaceInheritanceHierarchyMap>& interface_inheritance_hierarchy)
|
||||
: service_list_(service_list),
|
||||
subcontext_(subcontext),
|
||||
interface_inheritance_hierarchy_(interface_inheritance_hierarchy),
|
||||
service_(nullptr) {}
|
||||
ServiceParser(ServiceList* service_list, Subcontext* subcontext)
|
||||
: service_list_(service_list), subcontext_(subcontext), service_(nullptr) {}
|
||||
Result<void> ParseSection(std::vector<std::string>&& args, const std::string& filename,
|
||||
int line) override;
|
||||
Result<void> ParseLineSection(std::vector<std::string>&& args, int line) override;
|
||||
|
|
@ -88,7 +82,6 @@ class ServiceParser : public SectionParser {
|
|||
|
||||
ServiceList* service_list_;
|
||||
Subcontext* subcontext_;
|
||||
std::optional<InterfaceInheritanceHierarchyMap> interface_inheritance_hierarchy_;
|
||||
std::unique_ptr<Service> service_;
|
||||
std::string filename_;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -253,8 +253,7 @@ service $name /system/bin/yes
|
|||
"$selabel", GetSecurityContext(), false);
|
||||
ServiceList& service_list = ServiceList::GetInstance();
|
||||
Parser parser;
|
||||
parser.AddSectionParser("service",
|
||||
std::make_unique<ServiceParser>(&service_list, nullptr, std::nullopt));
|
||||
parser.AddSectionParser("service", std::make_unique<ServiceParser>(&service_list, nullptr));
|
||||
|
||||
TemporaryFile tf;
|
||||
ASSERT_GE(tf.fd, 0);
|
||||
|
|
|
|||
|
|
@ -30,8 +30,7 @@ namespace init {
|
|||
android::base::Result<ServiceInterfacesMap> GetOnDeviceServiceInterfacesMap() {
|
||||
ServiceList& service_list = ServiceList::GetInstance();
|
||||
Parser parser;
|
||||
parser.AddSectionParser("service",
|
||||
std::make_unique<ServiceParser>(&service_list, nullptr, std::nullopt));
|
||||
parser.AddSectionParser("service", std::make_unique<ServiceParser>(&service_list, nullptr));
|
||||
for (const auto& location : {
|
||||
"/init.rc",
|
||||
"/system/etc/init",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue