diff options
author | Tom Cherry <tomcherry@google.com> | 2018-10-22 14:50:52 -0700 |
---|---|---|
committer | Tom Cherry <tomcherry@google.com> | 2018-10-22 16:16:03 -0700 |
commit | b35f827c97ceb24e33fb2514ff62c8636bc46f59 (patch) | |
tree | 44ba8762fa4e6ae105797d6a03c07343ee6f11e7 /init/action_parser.cpp | |
parent | 5336d40ed4a33cf8650a579fe113d69415ccb687 (diff) |
init: if vendor_init can read a property, let it be a trigger too
There is a list of 'stable_properties' that vendor_init can use as
property triggers for Treble property compliance. This list came about
since init parses init scripts before all partitions are mounted and
therefore before all property context files are available, such that
init cannot use the normal SELinux mechanisms for determining if a
given property is vendor_init readable.
Currently though, we require all partitions that would contain
property context files to be mounted during first stage mount, so we
can use the normal SELinux mechanisms here, so this change deprecates
the stable_properties list and moves init to use SELinux to determine
if a property can be a trigger.
Bug: 71814576
Test: vendor_init fails to use non-readable properties as a trigger
Test: vendor_init successfully uses readable properties as a trigger
Change-Id: I6a914e8c212a3418cbf4a8a07215056aad2e0162
Diffstat (limited to 'init/action_parser.cpp')
-rw-r--r-- | init/action_parser.cpp | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/init/action_parser.cpp b/init/action_parser.cpp index 148116200..2d497b386 100644 --- a/init/action_parser.cpp +++ b/init/action_parser.cpp @@ -19,7 +19,11 @@ #include <android-base/properties.h> #include <android-base/strings.h> -#include "stable_properties.h" +#if defined(__ANDROID__) +#include "property_service.h" +#else +#include "host_init_stubs.h" +#endif using android::base::GetBoolProperty; using android::base::StartsWith; @@ -36,15 +40,7 @@ bool IsActionableProperty(Subcontext* subcontext, const std::string& prop_name) return true; } - if (kExportedActionableProperties.count(prop_name) == 1) { - return true; - } - for (const auto& prefix : kPartnerPrefixes) { - if (android::base::StartsWith(prop_name, prefix)) { - return true; - } - } - return false; + return CanReadProperty(subcontext->context(), prop_name); } Result<Success> ParsePropertyTrigger(const std::string& trigger, Subcontext* subcontext, |