Skip to content

Commit

Permalink
8345569: [ubsan] adjustments to filemap.cpp and virtualspace.cpp for …
Browse files Browse the repository at this point in the history
…macOS aarch64

Reviewed-by: mdoerr, lucy, dholmes
  • Loading branch information
MBaesken committed Dec 13, 2024
1 parent a9a5f7c commit 1d2ccae
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/hotspot/share/cds/filemap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2219,7 +2219,7 @@ address FileMapInfo::heap_region_dumptime_address() {
assert(CDSConfig::is_using_archive(), "runtime only");
assert(is_aligned(r->mapping_offset(), sizeof(HeapWord)), "must be");
if (UseCompressedOops) {
return /*dumptime*/ narrow_oop_base() + r->mapping_offset();
return /*dumptime*/ (address)((uintptr_t)narrow_oop_base() + r->mapping_offset());
} else {
return heap_region_requested_address();
}
Expand All @@ -2245,7 +2245,7 @@ address FileMapInfo::heap_region_requested_address() {
// Runtime base = 0x4000 and shift is also 0. If we map this region at 0x5000, then
// the value P can remain 0x1200. The decoded address = (0x4000 + (0x1200 << 0)) = 0x5200,
// which is the runtime location of the referenced object.
return /*runtime*/ CompressedOops::base() + r->mapping_offset();
return /*runtime*/ (address)((uintptr_t)CompressedOops::base() + r->mapping_offset());
} else {
// This was the hard-coded requested base address used at dump time. With uncompressed oops,
// the heap range is assigned by the OS so we will most likely have to relocate anyway, no matter
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/memory/virtualspace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ void ReservedHeapSpace::try_reserve_range(char *highest_start,
while (attach_point >= lowest_start &&
attach_point <= highest_start && // Avoid wrap around.
((_base == nullptr) ||
(_base < aligned_heap_base_min_address || _base + size > upper_bound))) {
(_base < aligned_heap_base_min_address || size > (uintptr_t)(upper_bound - _base)))) {
try_reserve_heap(size, alignment, page_size, attach_point);
attach_point -= stepsize;
}
Expand Down

3 comments on commit 1d2ccae

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MBaesken
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/backport jdk24u

@openjdk
Copy link

@openjdk openjdk bot commented on 1d2ccae Feb 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MBaesken the backport was successfully created on the branch backport-MBaesken-1d2ccaea-master in my personal fork of openjdk/jdk24u. To create a pull request with this backport targeting openjdk/jdk24u:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit 1d2ccaea from the openjdk/jdk repository.

The commit being backported was authored by Matthias Baesken on 13 Dec 2024 and was reviewed by Martin Doerr, Lutz Schmidt and David Holmes.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk24u:

$ git fetch https://github.com/openjdk-bots/jdk24u.git backport-MBaesken-1d2ccaea-master:backport-MBaesken-1d2ccaea-master
$ git checkout backport-MBaesken-1d2ccaea-master
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk24u.git backport-MBaesken-1d2ccaea-master

Please sign in to comment.