RFR: 8306767: Concurrent repacking of extra data in MethodData is potentially unsafe
Erik Österlund
eosterlund at openjdk.org
Wed Nov 29 14:55:07 UTC 2023
On Wed, 29 Nov 2023 07:38:50 GMT, Emanuel Peter <epeter at openjdk.org> wrote:
>> I think that anything that can return data from the extra data section is a potential danger. bci_to_data calls bci_to_extra_data at the end so it seems potentially unsafe which seems like a huge problem since that's used all over the place. Whether the callers are actually getting or expecting record from extra data is unclear. I would suspect that most places where it's used there should already be a preallocated record. The concurrent repacking really makes it hard to ensure the accesses are safe. I think the API would need to make a stronger split between preallocated records and records which might come from the extra data section. I'm honestly not sure how to make this truly safe.
>
> Ok. So this issue is much bigger than `query_update_method_data` and `allocate_bci_to_data`, is what you are saying. Sounds like I need to study this much deeper. Maybe we need to refactor the while way we access the records? Maybe any access to the records needs to be guarded with a lock, just to be safe?
> If there are concurrent updates, which are guarded by lock, then should not all reads also be guarded? In the end maybe we just need to make all accesses mutually exclusive, right?
Yeah, reading data from the extra data section, requires holding the lock.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16840#discussion_r1409402346
More information about the hotspot-dev
mailing list