diff options
author | Nikita Ioffe <ioffe@google.com> | 2020-11-27 18:57:44 +0000 |
---|---|---|
committer | Nikita Ioffe <ioffe@google.com> | 2020-12-02 11:14:07 +0000 |
commit | 8d6ae2dd8aebfd98e5b0968062b2f0c92fa0b0da (patch) | |
tree | 0332457fab777ae0fd4a8cc8e0e2caeee3250c60 /init/test_utils/service_utils.cpp | |
parent | c57f61ab23f2c3a57ff31cc6b611bc5a6a8de641 (diff) |
Fix potential use-after-free bug in reboot
Instead of operating on raw pointers, init now uses name of the
services as it's primary identifier. Only place that still uses
vector<Service*> is StopServices.
In addition, ServiceList::services() function is removed, which should
help avoiding similar bugs in the future.
Bug: 170315126
Bug: 174335499
Test: adb reboot
Test: atest CtsInitTestCases
Change-Id: I73ecd7a8c58c2ec3732934c595b7f7db814b7034
Ignore-AOSP-First: fixing security vulnerability
Diffstat (limited to 'init/test_utils/service_utils.cpp')
-rw-r--r-- | init/test_utils/service_utils.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/init/test_utils/service_utils.cpp b/init/test_utils/service_utils.cpp index ae68679bd..6426ed9fd 100644 --- a/init/test_utils/service_utils.cpp +++ b/init/test_utils/service_utils.cpp @@ -44,7 +44,7 @@ android::base::Result<ServiceInterfacesMap> GetOnDeviceServiceInterfacesMap() { } ServiceInterfacesMap result; - for (const auto& service : service_list.services()) { + for (const auto& service : service_list) { // Create an entry for all services, including services that may not // have any declared interfaces. result[service->name()] = service->interfaces(); |