RFR: 8356865: C2: Unreasonable values for debug flag FastAllocateSizeLimit can lead to left-shift-overflow, which is UB
Benoît Maillard
bmaillard at openjdk.org
Mon Jun 16 15:03:22 UTC 2025
This PR adds a range constraint for the `-XX:FastAllocateSizeLimit` debug flag. This prevents undefined behavior caused by shifting the flag value in `GraphKit::new_array`.
### Testing
- [ ] [GitHub Actions](https://github.com/benoitmaillard/jdk/actions?query=branch%3AJDK-8356865)
- [ ] tier1-3, plus some internal testing
- [x] Manual testing with values known to previously cause undefined behavior
Thanks!
-------------
Commit messages:
- 8356865: Add test for -XX:FastAllocateSizeLimit
- 8356865: Add assert for sanity check
- 8356865: Add range for FastAllocateSizeLimit flag
Changes: https://git.openjdk.org/jdk/pull/25834/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=25834&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8356865
Stats: 59 lines in 3 files changed: 59 ins; 0 del; 0 mod
Patch: https://git.openjdk.org/jdk/pull/25834.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/25834/head:pull/25834
PR: https://git.openjdk.org/jdk/pull/25834
More information about the hotspot-dev
mailing list