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

Matthias Baesken mbaesken at openjdk.org
Thu Jul 10 07:11:44 UTC 2025


On Mon, 7 Jul 2025 12:21:06 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 some macros/attributes to methods for avoiding ubsan  is probab...

This pull request has now been integrated.

Changeset: bf3cfbef
Author:    Matthias Baesken <mbaesken at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/bf3cfbeff414356aaf2b0933568ff648beace2c5
Stats:     8 lines in 2 files changed: 6 ins; 0 del; 2 mod

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

Reviewed-by: cjplummer, amenkov, sspitsyn

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

PR: https://git.openjdk.org/jdk/pull/26159


More information about the serviceability-dev mailing list