RFR: 8351487: [ubsan] jvmti.h runtime error: load of value which is not a valid value [v2]

Chris Plummer cjplummer at openjdk.org
Tue Jul 8 22:14:39 UTC 2025


On Tue, 8 Jul 2025 08:27:21 GMT, Matthias Baesken <mbaesken at openjdk.org> wrote:

>> When running with ubsan - enabled binaries, the following 2 issues are observed in jvmti.h (on macOS aarch64).
>> 
>> 
>> jtreg test vmTestbase/nsk/jvmti/SetVerboseFlag/setvrbflag002/TestDescription.java 
>> 
>> /priv/jenkins/client-home/workspace/openjdk-jdk-weekly-macos_aarch64-opt/build/support/modules_include/java.base/jvmti.h:2645:44: runtime error: load of value 4294967295, which is not a valid value for type 'jvmtiVerboseFlag'
>>     #0 0x104453540 in _jvmtiEnv::SetVerboseFlag(jvmtiVerboseFlag, unsigned char) jvmti.h:2645
>>     #1 0x10444ed5c in agentProc(_jvmtiEnv*, JNIEnv_*, void*) setvrbflag002.cpp:49
>>     #2 0x10444f1c8 in agentThreadWrapper(_jvmtiEnv*, JNIEnv_*, void*) agent_tools.cpp:151
>>     #3 0x10914895c in JvmtiAgentThread::call_start_function() jvmtiImpl.cpp:89
>>     #4 0x108ebd7f0 in JavaThread::thread_main_inner() javaThread.cpp:776
>>     #5 0x1096f6094 in Thread::call_run() thread.cpp:231
>>     #6 0x10941c37c in thread_native_entry(Thread*) os_bsd.cpp:601
>>     #7 0x1936fef90 in _pthread_start+0x84 (libsystem_pthread.dylib:arm64e+0x6f90)
>>     #8 0x1936f9d30 in thread_start+0x4 (libsystem_pthread.dylib:arm64e+0x1d30)
>> 
>> vmTestbase/nsk/jvmti/GetErrorName/geterrname002/TestDescription.java
>> 
>> /priv/jenkins/client-home/workspace/openjdk-jdk-weekly-macos_aarch64-opt/build/support/modules_include/java.base/jvmti.h:2640:42: runtime error: load of value 4294967295, which is not a valid value for type 'jvmtiError'
>>     #0 0x1002b3504 in _jvmtiEnv::GetErrorName(jvmtiError, char**) jvmti.h:2640
>>     #1 0x1002aec9c in agentProc(_jvmtiEnv*, JNIEnv_*, void*) geterrname002.cpp:50
>>     #2 0x1002af198 in agentThreadWrapper(_jvmtiEnv*, JNIEnv_*, void*) agent_tools.cpp:151
>>     #3 0x104f4895c in JvmtiAgentThread::call_start_function() jvmtiImpl.cpp:89
>>     #4 0x104cbd7f0 in JavaThread::thread_main_inner() javaThread.cpp:776
>>     #5 0x1054f6094 in Thread::call_run() thread.cpp:231
>>     #6 0x10521c37c in thread_native_entry(Thread*) os_bsd.cpp:601
>>     #7 0x1936fef90 in _pthread_start+0x84 (libsystem_pthread.dylib:arm64e+0x6f90)
>>     #8 0x1936f9d30 in thread_start+0x4 (libsystem_pthread.dylib:arm64e+0x1d30)
>> 
>> 
>> So the problem reported is SetVerboseFlag method (which is part of the VM) calls SetVerboseFlag function with that bad argument ;  but the test code seems to intentionally use 'bad' arguments . But this does not work well with ubsan ;  so better exclude those tests from ubsan checking .
>> Please note that jvmti.h is shipped so adding...
>
> Matthias Baesken has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Add comments

test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetErrorName/geterrname002/TestDescription.java line 40:

> 38:  * @requires !vm.ubsan
> 39:  * @comment We test with arguments out of scope of the jvmti enums, this causes
> 40:  *          ubsan issues.

Suggestion:

 * @comment We test with arguments out of scope of the jvmti enums, which causes
 *          ubsan issues.

test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetVerboseFlag/setvrbflag002/TestDescription.java line 39:

> 37:  * @requires !vm.ubsan
> 38:  * @comment We test with arguments out of scope of the jvmti enums, this causes
> 39:  *          ubsan issues.

Suggestion:

 * @comment We test with arguments out of scope of the jvmti enums, which causes
 *          ubsan issues.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/26159#discussion_r2193521845
PR Review Comment: https://git.openjdk.org/jdk/pull/26159#discussion_r2193522041


More information about the serviceability-dev mailing list