When running ubsan-enabled binaries on Linux x86_64, os::attempt_reserve_memory_between reports overflows.
/jdk/src/hotspot/share/runtime/os.cpp:1938:34: runtime error: pointer index expression with base 0x000000001000 overflowed to 0xfffffffffffff000
However the function already contains overflow handling, so probably it is sufficient to add an attribute to the function os::attempt_reserve_memory_between to disable ubsan checks for this function.
test to reproduce is
gtest/LargePageGtests_use-large-pages.jtr
========
src/hotspot/share/runtime/os.cpp:1938:34: runtime error: pointer index expression with base 0x000000001000 overflowed to 0xfffffffffffff000
#0 0x7fe1b98d8c56 in os::attempt_reserve_memory_between(char*, char*, unsigned long, unsigned long, bool) src/hotspot/share/runtime/os.cpp:1938
#1 0x7fe1b6c52620 in call_attempt_reserve_memory_between test/hotspot/gtest/runtime/test_os_reserve_between.cpp:69
#2 0x7fe1b6c58e15 in test_attempt_reserve_memory_between test/hotspot/gtest/runtime/test_os_reserve_between.cpp:108
#3 0x7fe1b6c5a3c3 in os_attempt_reserve_memory_between_combos_vm_Test::TestBody() test/hotspot/gtest/runtime/test_os_reserve_between.cpp:291
#4 0x7fe1ba961603 in testing::Test::Run() /gtest/googletest-1.14.0/googletest/src/gtest.cc:2687
#5 0x7fe1ba961603 in testing::Test::Run() /gtest/googletest-1.14.0/googletest/src/gtest.cc:2677
#6 0x7fe1ba961d0d in testing::TestInfo::Run() /gtest/googletest-1.14.0/googletest/src/gtest.cc:2836
#7 0x7fe1ba992618 in testing::TestSuite::Run() /gtest/googletest-1.14.0/googletest/src/gtest.cc:3015
#8 0x7fe1ba992618 in testing::TestSuite::Run() gtest/googletest-1.14.0/googletest/src/gtest.cc:2968
#9 0x7fe1ba9935e5 in testing::internal::UnitTestImpl::RunAllTests() /gtest/googletest-1.14.0/googletest/src/gtest.cc:5920
#10 0x7fe1ba95988f in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /gtest/googletest-1.14.0/googletest/src/gtest.cc:2670
#11 0x7fe1ba95988f in testing::UnitTest::Run() /gtest/googletest-1.14.0/googletest/src/gtest.cc:5484
#12 0x7fe1b65e4d27 in RUN_ALL_TESTS() gtest/googletest-1.14.0/googletest/include/gtest/gtest.h:2317
#13 0x7fe1b65e4d27 in runUnitTestsInner test/hotspot/gtest/gtestMain.cpp:290
#14 0x56268b2d17d8 in main test/hotspot/gtest/gtestLauncher.cpp:40
#15 0x7fe1b064624c in __libc_start_main (/lib64/libc.so.6+0x3524c) (BuildId: f732026552f6adff988b338e92d466bc81a01c37)
/jdk/src/hotspot/share/runtime/os.cpp:1938:34: runtime error: pointer index expression with base 0x000000001000 overflowed to 0xfffffffffffff000
However the function already contains overflow handling, so probably it is sufficient to add an attribute to the function os::attempt_reserve_memory_between to disable ubsan checks for this function.
test to reproduce is
gtest/LargePageGtests_use-large-pages.jtr
========
src/hotspot/share/runtime/os.cpp:1938:34: runtime error: pointer index expression with base 0x000000001000 overflowed to 0xfffffffffffff000
#0 0x7fe1b98d8c56 in os::attempt_reserve_memory_between(char*, char*, unsigned long, unsigned long, bool) src/hotspot/share/runtime/os.cpp:1938
#1 0x7fe1b6c52620 in call_attempt_reserve_memory_between test/hotspot/gtest/runtime/test_os_reserve_between.cpp:69
#2 0x7fe1b6c58e15 in test_attempt_reserve_memory_between test/hotspot/gtest/runtime/test_os_reserve_between.cpp:108
#3 0x7fe1b6c5a3c3 in os_attempt_reserve_memory_between_combos_vm_Test::TestBody() test/hotspot/gtest/runtime/test_os_reserve_between.cpp:291
#4 0x7fe1ba961603 in testing::Test::Run() /gtest/googletest-1.14.0/googletest/src/gtest.cc:2687
#5 0x7fe1ba961603 in testing::Test::Run() /gtest/googletest-1.14.0/googletest/src/gtest.cc:2677
#6 0x7fe1ba961d0d in testing::TestInfo::Run() /gtest/googletest-1.14.0/googletest/src/gtest.cc:2836
#7 0x7fe1ba992618 in testing::TestSuite::Run() /gtest/googletest-1.14.0/googletest/src/gtest.cc:3015
#8 0x7fe1ba992618 in testing::TestSuite::Run() gtest/googletest-1.14.0/googletest/src/gtest.cc:2968
#9 0x7fe1ba9935e5 in testing::internal::UnitTestImpl::RunAllTests() /gtest/googletest-1.14.0/googletest/src/gtest.cc:5920
#10 0x7fe1ba95988f in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /gtest/googletest-1.14.0/googletest/src/gtest.cc:2670
#11 0x7fe1ba95988f in testing::UnitTest::Run() /gtest/googletest-1.14.0/googletest/src/gtest.cc:5484
#12 0x7fe1b65e4d27 in RUN_ALL_TESTS() gtest/googletest-1.14.0/googletest/include/gtest/gtest.h:2317
#13 0x7fe1b65e4d27 in runUnitTestsInner test/hotspot/gtest/gtestMain.cpp:290
#14 0x56268b2d17d8 in main test/hotspot/gtest/gtestLauncher.cpp:40
#15 0x7fe1b064624c in __libc_start_main (/lib64/libc.so.6+0x3524c) (BuildId: f732026552f6adff988b338e92d466bc81a01c37)