Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7c93b040 authored by David Ng's avatar David Ng Committed by Linux Build Service Account
Browse files

init: powerctl: Reject "keys*" reboot reason unless in recovery

Reject all reboot reason starting with "keys" unless in
recovery mode.  This avoids mission mode, non-root (e.g. shell)
users for triggering privileged reboot modes.

Change-Id: I3727d0a92627a6cdf5f762ac61625c30bfa88946
parent 725a8913
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -584,7 +584,14 @@ int do_powerctl(int nargs, char **args)
    }

    if (command[len] == ',') {
        char prop_value[PROP_VALUE_MAX] = {0};
        reboot_target = &command[len + 1];

        if ((property_get("init.svc.recovery", prop_value) == 0) &&
            (strncmp(reboot_target, "keys", 4) == 0)) {
            ERROR("powerctl: permission denied\n");
            return -EINVAL;
        }
    } else if (command[len] == '\0') {
        reboot_target = "";
    } else {