RFR: 8346916: [REDO] align_up has potential overflow [v10]
duke
duke at openjdk.org
Thu Mar 13 08:58:54 UTC 2025
On Tue, 11 Mar 2025 15:55:00 GMT, Casper Norrbin <cnorrbin at openjdk.org> wrote:
>> 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 assert in align_up
@caspernorrbin
Your change (at version 5dc102eab58692dd9d03b2d122be54235cd57d74) is now ready to be sponsored by a Committer.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/23711#issuecomment-2720475358
More information about the hotspot-dev
mailing list