RFR: 8331201: UBSAN enabled build reports on Linux x86_64 runtime error: shift exponent 65 is too large for 64-bit type 'long unsigned int' [v2]

Kim Barrett kbarrett at openjdk.org
Thu Dec 19 16:30:41 UTC 2024


On Thu, 19 Dec 2024 08:46:57 GMT, Afshin Zafari <azafari at openjdk.org> wrote:

>> The issue existed in making Fingerprints of method names. Each parameter in the methods' arguments is decoded as a 4-bits value. The 64-bits `fingertprint_t` can hold up to 14 parameters plus return type and static bit. To make the Fingerprint, the signature is iterated one parameter at a time and the corresponding code is accumulated after shifting the bits up.
>> Some compilers do not mask the shift value to the base size and UBSAN catches the case. 
>> In this PR, the number of parameters (`_param_count`) is used and compared with the max (14) to do the shift operation safely. The pre-existing `_param_size` is not reflecting the number of parameters, since it is incremented by 2 for `T_DOUBLE` and `T_LONG` types.
>
> Afshin Zafari has updated the pull request incrementally with one additional commit since the last revision:
> 
>   removed extra blank lines

src/hotspot/share/runtime/signature.cpp line 191:

> 189: 
> 190:   // Detect overflow.  (We counted _param_size correctly.)
> 191:   if (_method == nullptr && _param_count > fp_max_size_of_parameters) {

Seems like `fp_max_size_of_parameters` ought to be renamed.  But I found other uses
that are comparing to something else, so maybe there are problems elsewhere.
Also, the use of "size" in both the preceding and following comments needs to be updated.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22807#discussion_r1892625336


More information about the hotspot-runtime-dev mailing list