RFR: 8352420: [ubsan] codeBuffer.cpp:984:27: runtime error: applying non-zero offset 18446744073709486080 to null pointer

Doug Simon dnsimon at openjdk.org
Thu Mar 20 10:27:52 UTC 2025


On Wed, 19 Mar 2025 15:43:54 GMT, Doug Simon <dnsimon at openjdk.org> wrote:

> This PR addresses undefined behavior in CodeBuffer by making `verify_section_allocation` return early for a partially initialized CodeBuffer.

@MBaesken can you please test this change on a ubsan enabled build or remind me how I can do that myself.

Unfortunately, looks like there's another ubsan issue blocking my way:

~/d/jdk-jdk/open (master)> make CONF_NAME=macosx-aarch64 LOG=info TEST=compiler/jvmci/errors/TestInvalidCompilationResult.java test
Building configuration 'macosx-aarch64' (matching CONF_NAME=macosx-aarch64)
Generating main target list
Building configuration 'macosx-aarch64' (matching CONF_NAME=macosx-aarch64)
Running make as '/Applications/Xcode.app/Contents/Developer/usr/bin/make CONF_NAME=macosx-aarch64 LOG=info TEST=compiler/jvmci/errors/TestInvalidCompilationResult.java test'
Building target 'test' in configuration 'macosx-aarch64'
Building JVM variant 'server' with features 'cds compiler1 compiler2 dtrace epsilongc g1gc jfr jni-check jvmci jvmti management parallelgc serialgc services vm-structs zgc'
ad_aarch64.hpp:7096:11: runtime error: shift exponent 100 is too large for 32-bit type 'uint' (aka 'unsigned int')
    #0 0x105728714 in Pipeline_Use_Element::step(unsigned int) ad_aarch64.hpp:7150
    #1 0x105721bf8 in Pipeline_Use::step(unsigned int) ad_aarch64.hpp:7198
    #2 0x105724630 in Scheduling::AddNodeToBundle(Node*, Block const*) output.cpp:2553
    #3 0x105722b40 in Scheduling::DoScheduling() output.cpp:2816
    #4 0x10571745c in PhaseOutput::ScheduleAndBundle() output.cpp:2167
    #5 0x1057147c8 in PhaseOutput::Output() output.cpp:341
    #6 0x104b6dff8 in Compile::Code_Gen() compile.cpp:3082
    #7 0x104b6af48 in Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*) compile.cpp:893
    #8 0x104b6e0e0 in Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*) compile.cpp:695
    #9 0x1049f58c8 in C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*) c2compiler.cpp:141
    #10 0x104b928ec in CompileBroker::invoke_compiler_on_method(CompileTask*) compileBroker.cpp:2331
    #11 0x104b91aec in CompileBroker::compiler_thread_loop() compileBroker.cpp:1975
    #12 0x10519809c in JavaThread::thread_main_inner() javaThread.cpp:776
    #13 0x105197d50 in JavaThread::run() javaThread.cpp:761
    #14 0x1059e1b28 in Thread::call_run() thread.cpp:231
    #15 0x1056ff3bc in thread_native_entry(Thread*) os_bsd.cpp:601
    #16 0x1810602e0 in _pthread_start+0x84 (libsystem_pthread.dylib:arm64e+0x72e0) (BuildId: 642faf7a874e37e68aba2b0cc09a302532000000200000000100000000030f00)
    #17 0x18105b0f8 in thread_start+0x4 (libsystem_pthread.dylib:arm64e+0x20f8) (BuildId: 642faf7a874e37e68aba2b0cc09a302532000000200000000100000000030f00)


This build is using Xcode 14.3.1.

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

PR Comment: https://git.openjdk.org/jdk/pull/24118#issuecomment-2737144179
PR Comment: https://git.openjdk.org/jdk/pull/24118#issuecomment-2739695432


More information about the hotspot-compiler-dev mailing list