RFR: 8346916: [REDO] align_up has potential overflow [v8]
    Casper Norrbin 
    cnorrbin at openjdk.org
       
    Wed Mar  5 14:13:36 UTC 2025
    
    
  
> Hi everyone,
> 
> The `align_up` function can potentially overflow, resulting in undefined behavior. Most use cases rely on the assumption that aligned_result >= original. To address this, I've added an assertion to verify this condition.
> 
> The original PR (#20808) missed cases where overflow checks already existed, so I've now went through usages of `align_up` and found the places with explicit checks. Most notably, #23168 added `align_up_or_null` to metaspace, but this function is also useful elsewhere. Given this, I relocated it to `align.hpp`, alongside the rest of the alignment functions.
Casper Norrbin has updated the pull request incrementally with one additional commit since the last revision:
  changed psoldgen check back to earlier version
-------------
Changes:
  - all: https://git.openjdk.org/jdk/pull/23711/files
  - new: https://git.openjdk.org/jdk/pull/23711/files/f52de010..31a7d55e
Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=23711&range=07
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=23711&range=06-07
  Stats: 12 lines in 1 file changed: 4 ins; 7 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/23711.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/23711/head:pull/23711
PR: https://git.openjdk.org/jdk/pull/23711
    
    
More information about the hotspot-dev
mailing list