summaryrefslogtreecommitdiff
path: root/native/android/input.cpp
diff options
context:
space:
mode:
author Hani Kazmi <hanikazmi@google.com> 2022-08-23 10:41:17 +0000
committer Hani Kazmi <hanikazmi@google.com> 2022-09-02 14:09:15 +0000
commit9da89484bdae926726688dc164b911ca44e6da83 (patch)
tree09da74aed77d1ff0da825f05c79787b5852f7c49 /native/android/input.cpp
parentbb3501c4e7c0f41c7303943f9f6cbe498dbb0e30 (diff)
Add a lock when unwrapping lazy value in bundles
This commit addresses a race condition introduced in ag/18909939. If multiple threads try to read the same lazy value out of mMap in parallel, it is possible for both to decrement mLazyValues, thus failing the precondition check, or recycling the parcel twice. While bundles do not guarantee thread safety, there have already been enough reports of impacted usecases that it is worth mitigating at the root. It is possible to shorten the lock to not include the recycle block, but both implementations did not show any performance difference in preliminary testing. Bug: 241888992 Test: Reproduced race condition on physical device, and validated that code change fixes it. Test: atest android.os.cts.ParcelTest android.os.cts.BundleTest android.os.BundleTest android.os.ParcelTest android.os.BundleRecylingTest Change-Id: I5d261d4315a123008b226c364fec73634e08a150
Diffstat (limited to 'native/android/input.cpp')
0 files changed, 0 insertions, 0 deletions