Merge "Don't mark odsign as oneshot." am: 5c19d23b52 am: d5847cf879

Original change: https://android-review.googlesource.com/c/platform/system/security/+/1781067

Change-Id: I1879cf20b97c07307fdf6c718e224b12945a2b68
This commit is contained in:
Martijn Coenen 2021-07-28 12:20:34 +00:00 committed by Automerger Merge Worker
commit d09f0cd7f5
2 changed files with 12 additions and 3 deletions

View file

@ -2,5 +2,8 @@ service odsign /system/bin/odsign
class core
user root
group system
oneshot
disabled # does not start with the core class
# Note that odsign is not oneshot, but stopped manually when it exits. This
# ensures that if odsign crashes during a module update, apexd will detect
# those crashes and roll back the update.

View file

@ -75,6 +75,8 @@ static const char* kOdsignVerificationStatusProp = "odsign.verification.success"
static const char* kOdsignVerificationStatusValid = "1";
static const char* kOdsignVerificationStatusError = "0";
static const char* kStopServiceProp = "ctl.stop";
static void writeBytesToFile(const std::vector<uint8_t>& bytes, const std::string& path) {
std::string str(bytes.begin(), bytes.end());
android::base::WriteStringToFile(str, path);
@ -552,8 +554,10 @@ int main(int /* argc */, char** /* argv */) {
// Tell init we don't need to use our key anymore
SetProperty(kOdsignKeyDoneProp, "1");
// Tell init we're done with verification, and that it was an error
SetProperty(kOdsignVerificationDoneProp, "1");
SetProperty(kOdsignVerificationStatusProp, kOdsignVerificationStatusError);
SetProperty(kOdsignVerificationDoneProp, "1");
// Tell init it shouldn't try to restart us - see odsign.rc
SetProperty(kStopServiceProp, "odsign");
};
auto scope_guard = android::base::make_scope_guard(errorScopeGuard);
@ -668,8 +672,10 @@ int main(int /* argc */, char** /* argv */) {
// At this point, we're done with the key for sure
SetProperty(kOdsignKeyDoneProp, "1");
// And we did a successful verification
SetProperty(kOdsignVerificationDoneProp, "1");
SetProperty(kOdsignVerificationStatusProp, kOdsignVerificationStatusValid);
SetProperty(kOdsignVerificationDoneProp, "1");
// Tell init it shouldn't try to restart us - see odsign.rc
SetProperty(kStopServiceProp, "odsign");
return 0;
}