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

Commit 7598f6bf authored by Tim Van Patten's avatar Tim Van Patten
Browse files

gpuservice: Fix FeatureOverrides std::map crash

The std::map copy constructor invoked by
FeatureOverrideParser::getFeatureOverrides() is crashing. The most
likely cause appears to be multiple threads attempting to update update
FeatureOverrideParser::mFeatureOverrides simultaneously while servicing
Binder requests during device boot. This hasn't been proven empirically
with a recreate though.

Remove this possibility by populating
FeatureOverrideParser::mFeatureOverrides as part of the
FeatureOverrideParser constructor. This is performed as part of the
GpuService constructor, before any threads are forked for Binder.

Additionally:
* FeatureOverrideParser::getFeatureOverrides() is renamed to
  getCachedFeatureOverrides() to make it clear it only returns the
  cached values.
* FeatureOverrideParser::forceFileRead() is removed, since it's no
  longer possible to re-read the file at run-time and repopulate
  FeatureOverrideParser::mFeatureOverrides.

While these changes should eliminate the crash, they also remove the
ability to update the file at run-time without restarting gpuservice.
The alternative is to acquire a mutex in
GpuService::getFeatureOverrides() (and
GpuService::cmdFeatureOverrides()) which could impact performance, since
it's called as part of every app launch. This will need to be evaluated
if reloading the file at run-time is necessary and added in the future.

Bug: b/425292768
Test: atest gpuservice_unittest
Flag: EXEMPT bugfix
Change-Id: I98f26bad040286a1d4eb0d59460f5f10601d3d38
parent 5e116051
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment