Skip to content
Commit 80a7cdf4 authored by Daniel Cheng's avatar Daniel Cheng Committed by Chromium LUCI CQ
Browse files

Further harden base::SupportsUserData against reentrancy

`SupportsUserData`'s destructor tries to ensure it presents a consistent
view of itself to `SupportsUserData::Data` instances by swapping the
internal map to a local before deleting `SupportsUserData::Data`
instances. Extend this same protection to `ClearAllUserData()` and
update `ClearAllUserData()` to similarly block mutation during the clear
operation.

Finally, block all operations other than `GetUserData()` while clearing
`SupportsUserData::Data` instances. This sort of reentrancy can only
lead to trouble; `GetUserData()` is the sole exception since there are
likely too many existing violations to easily fix at this time.

Bug: 40222690
Change-Id: I1cb47152a51c90c8b75911fb6be245be2ec7ca5d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5610828


Reviewed-by: default avatarErik Chen <erikchen@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1312603}
parent 04c8a99b
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