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

Skip to content
Commit ab4e67c2 authored by Hani Kazmi's avatar Hani Kazmi
Browse files

Synchronize on parcel for LazyValue methods

With the changes introduced in ag/18795008, the parcel underlying a
Bundle's LazyValues is recycled once all the LazyValues have been
unwrapped. This has introduced a new race condition. If a key with an
wrapped LazyValue is accessed (in thread A), while simultaneously a
different thread (B) writes the bundle to a Parcel, B may check the
parcel is unrecycled before A finishes unwrapping it, then try to copy
the parcel after it is recycled by A.

To avoid this, we now synchronize on the parcel in all methods where
it's contents need to be accessed after the initial check.

Bug: 267096262
Test: Debugged with break points in critical section to reproduce before
and after fix
Test: atest -d android.os.cts.ParcelTest android.os.cts.BundleTest
android.os.BundleTest android.os.ParcelTest

Change-Id: I055d31892e46574b9e450ece7f5042a9eb185c40
parent aa24b1bd
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment