RFR: 8352140: UBSAN: fix the left shift of negative value in klass.hpp, array_layout_helper() [v2]

Afshin Zafari azafari at openjdk.org
Fri Apr 25 08:46:15 UTC 2025


> The `array_layout_helper()` with `jint tag` as its first arg, is called with a `tag` whose sign-bit is always set and considered as negative. This negative value is UB in left-shift operation.  Changing the type to `juint`  fixes this.
> 
> Tests:
> linux-x64-debug tier1 with UBSAN enabled.

Afshin Zafari has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains two additional commits since the last revision:

 - Merge remote-tracking branch 'origin/master' into _8352140_lshift_klass_hpp
 - 8352140: UBSAN: fix the left shift of negative value in klass.hpp, array_layout_helper()

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/24184/files
  - new: https://git.openjdk.org/jdk/pull/24184/files/3fa63e4b..5b17d732

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=24184&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=24184&range=00-01

  Stats: 363725 lines in 4348 files changed: 106340 ins; 240781 del; 16604 mod
  Patch: https://git.openjdk.org/jdk/pull/24184.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/24184/head:pull/24184

PR: https://git.openjdk.org/jdk/pull/24184


More information about the hotspot-dev mailing list