RFR: 8306767: Concurrent repacking of extra data in MethodData is potentially unsafe

Tom Rodriguez never at openjdk.org
Wed Nov 29 07:33:04 UTC 2023


On Wed, 29 Nov 2023 07:23:26 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> I see.
>> And how about other usages of `ProfileData` from the `mdo`, like these (there is a few variants of them around):
>> 
>> ProfileData* data = mdo->first_data();
>> ProfileData* data = mdo->bci_to_data(bci);
>
> And there are 2 uses of `query_update_method_data`. One does not use the return `pdata`. The other uses it and in some cases updates it. Do you think it is safe to just re-fetch it, or would that potentially cut some connection between the two that should not be cut?
> The alternative is just to already get the lock before calling `query_update_method_data`.

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.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/16840#discussion_r1408858242


More information about the hotspot-dev mailing list