RFR: 8346971: [ubsan] psCardTable.cpp:131:24: runtime error: large index is out of bounds [v3]

Kim Barrett kbarrett at openjdk.org
Tue Jan 14 16:27:13 UTC 2025


> Please review this change to PSStripeShadowCardTable to avoid several examples
> of UB in it's internal calculations.  We avoid the UB by switching to the
> integer domain (using uintptr_t) for all of the internal calculations, with
> casts between pointers and uintptr_t as needed at the boundaries.
> 
> This applies not just to the various pointer adjustments, but also to pointer
> comparisons. In particular, the prior range check assertions using pointer
> comparisons could have been partially or even completely "optimized" away
> based on the no-UB assumption.
> 
> Testing: mach5 tier1-5
> local (linux-x64) tier1 with -XX:+UseParallelGC

Kim Barrett 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 four additional commits since the last revision:

 - Merge branch 'master' into pscardtable-ubsan
 - fix exclusive check, rename to verify
 - typo: intptr_t => uintptr_t
 - avoid UB

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/23032/files
  - new: https://git.openjdk.org/jdk/pull/23032/files/58c704f7..a6dbfeda

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

  Stats: 11917 lines in 695 files changed: 3795 ins; 5185 del; 2937 mod
  Patch: https://git.openjdk.org/jdk/pull/23032.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/23032/head:pull/23032

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


More information about the hotspot-gc-dev mailing list