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

Skip to content
Commit 9339952b authored by Steven Moreland's avatar Steven Moreland
Browse files

surfaceflinger: fix race condition

surfaceflinger only has one thread.

main thread is:
a). startHidlServices
b). do a getService
c). getService receives notification on binder thread and returns
d). binder ServiceManager register SF service

Then, started by a).
hwbinder thread is (DisplayService's, when it receives a transaction):
e). binder ServiceManager get SF service ( (d) must happen first! )

Normally, (e) never happens because nothing calls into DisplayService
until later. However, on a particular QCOM device (b/80061790),
surfaceflinger restarts at just the right time that this sequence happens:
(a) (b) (e)

then (c) is blocked since (e) is on a binder thread).

Test: QCOM device no longer enters this deadlock
Test: boot up on Pixel device
Test: (sanity) check to make sure surface flinger has one hwbinder thread
Test: (sanity) make sure Pixel device surface flinger doesn't register an
    allocator when it isn't supposed to.

As a follow-up, the return values from these various services will be
checked.

Bug: 80061790
Change-Id: I254d70951ee9508790c940240bcd1da5af746dd3
parent c61c0c11
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