RFR: 8312401: SymbolTable::do_add_if_needed hang when requesting length exceeds max_symbol_length [v2]
Jiangli Zhou
jiangli at openjdk.org
Mon Jul 24 16:38:43 UTC 2023
On Mon, 24 Jul 2023 02:10:47 GMT, David Holmes <dholmes at openjdk.org> wrote:
> I don't think this is generally the correct way to approach this. We should only be using String::as_symbol when we know the String will fit into a Symbol - if it doesn't then we shouldn't be using this process. So any errors here should be fatal IMO. Each of the clients of this API should be examined to check valid usage i.e. it is okay for field/methods names due to 64K limit on those, but not for class/interface names - and certainly not for arbitrary strings like exception messages! Relatedly the usages of java_lang_Throwable::detail_message should also be examined.
All the other direct usages of java_lang_String::as_symbol are okay, except one from java_lang_Throwable::detail_message. All other callers convert a type string into a Symbol.
I changed java_lang_String::as_symbol to truncate the string for java_lang_Throwable::detail_message usage mainly. Instead we should `guarantee` the string length to be < Symbol::max_length in java_lang_String::as_symbol.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/14938#discussion_r1272501494
More information about the hotspot-runtime-dev
mailing list