Skip to content

8342823: Ubsan: ciEnv.cpp:1614:65: runtime error: member call on null pointer of type 'struct CompileTask' #21684

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from

Conversation

MBaesken
Copy link
Member

@MBaesken MBaesken commented Oct 24, 2024

When running with ubsanized binaries on Linux x86_64,
hs jtreg test compiler/startup/StartupOutput.java
showed this issue

jdk/src/hotspot/share/ci/ciEnv.cpp:1614:65: runtime error: member call on null pointer of type 'struct CompileTask'
#0 0x7fcea0810117 in ciEnv::dump_replay_data_helper(outputStream*) src/hotspot/share/ci/ciEnv.cpp:1614
#1 0x7fcea3123577 in VMError::report_and_die(int, char const*, char const*, __va_list_tag*, Thread*, unsigned char*, void*, void*, char const*, int, unsigned long) src/hotspot/share/utilities/vmError.cpp:1872
#2 0x7fcea0c01499 in report_fatal(VMErrorType, char const*, int, char const*, ...) src/hotspot/share/utilities/debug.cpp:214
#3 0x7fcea09e9d85 in RuntimeStub::new_runtime_stub(char const*, CodeBuffer*, short, int, OopMapSet*, bool, bool) src/hotspot/share/code/codeBlob.cpp:413
#4 0x7fcea066da1d in Runtime1::generate_blob(BufferBlob*, C1StubId, char const*, bool, StubAssemblerCodeGenClosure*) src/hotspot/share/c1/c1_Runtime1.cpp:233
#5 0x7fcea066dfb0 in Runtime1::generate_blob_for(BufferBlob*, C1StubId) src/hotspot/share/c1/c1_Runtime1.cpp:262
#6 0x7fcea066dfb0 in Runtime1::initialize(BufferBlob*) src/hotspot/share/c1/c1_Runtime1.cpp:272
#7 0x7fcea03d2be1 in Compiler::init_c1_runtime() src/hotspot/share/c1/c1_Compiler.cpp:53
#8 0x7fcea03d2be1 in Compiler::initialize() src/hotspot/share/c1/c1_Compiler.cpp:74
#9 0x7fcea0acc0c2 in CompileBroker::init_compiler_runtime() src/hotspot/share/compiler/compileBroker.cpp:1771
#10 0x7fcea0ad9a3f in CompileBroker::compiler_thread_loop() src/hotspot/share/compiler/compileBroker.cpp:1913
#11 0x7fcea161264a in JavaThread::thread_main_inner() src/hotspot/share/runtime/javaThread.cpp:759
#12 0x7fcea2ec739a in Thread::call_run() src/hotspot/share/runtime/thread.cpp:234
#13 0x7fcea251e1d2 in thread_native_entry src/hotspot/os/linux/os_linux.cpp:858
#14 0x7fcea7c6c6e9 in start_thread (/lib64/libpthread.so.0+0xa6e9) (BuildId: 1b515766201d47a183932ba0c8c8bd0d9ee8755b)
#15 0x7fcea730f58e in clone (/lib64/libc.so.6+0x11858e) (BuildId: 448a3ddd22596e1adb8fb3dec8921ed5b9d54dc2)

So a nullptr check should be better added .


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8342823: Ubsan: ciEnv.cpp:1614:65: runtime error: member call on null pointer of type 'struct CompileTask' (Bug - P4)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/21684/head:pull/21684
$ git checkout pull/21684

Update a local copy of the PR:
$ git checkout pull/21684
$ git pull https://git.openjdk.org/jdk.git pull/21684/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 21684

View PR using the GUI difftool:
$ git pr show -t 21684

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/21684.diff

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Oct 24, 2024

👋 Welcome back mbaesken! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Oct 24, 2024

@MBaesken This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8342823: Ubsan: ciEnv.cpp:1614:65: runtime error: member call on null pointer of type 'struct CompileTask'

Reviewed-by: kvn, mdoerr

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 43 new commits pushed to the master branch:

  • d49f210: 8342040: Further improve entry lookup performance for multi-release JARs
  • d2e716e: 8331958: Update PC/SC Lite for Suse Linux to 2.3.0
  • a95374f: 8343101: Rework BasicTest.testTemp test cases
  • 00fe9f7: 8343100: Consolidate EmptyFolderTest and EmptyFolderPackageTest jpackage tests into single java file
  • 9f6d5b4: 8343020: (fs) Add support for SecureDirectoryStream on macOS
  • 1341b81: 8341666: FileInputStream doesn't support readAllBytes() or readNBytes(int) on pseudo devices
  • 52382e2: 8338021: Support new unsigned and saturating vector operators in VectorAPI
  • e659d9d: 8342975: C2: Micro-optimize PhaseIdealLoop::Dominators()
  • 9f6211b: 8341371: CDS cannot load archived heap objects with -XX:+UseSerialGC -XX:-UseCompressedOops
  • 120a935: 8342561: Metaspace for generated reflection classes is no longer needed
  • ... and 33 more: https://git.openjdk.org/jdk/compare/85774b713edf8782f162ac25b61ce99a77e116f4...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot changed the title JDK-8342823: Ubsan: ciEnv.cpp:1614:65: runtime error: member call on null pointer of type 'struct CompileTask' 8342823: Ubsan: ciEnv.cpp:1614:65: runtime error: member call on null pointer of type 'struct CompileTask' Oct 24, 2024
@openjdk openjdk bot added the rfr Pull request is ready for review label Oct 24, 2024
@openjdk
Copy link

openjdk bot commented Oct 24, 2024

@MBaesken The following label will be automatically applied to this pull request:

  • hotspot-compiler

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@mlbridge
Copy link

mlbridge bot commented Oct 24, 2024

Webrevs

Copy link
Contributor

@vnkozlov vnkozlov left a comment

Choose a reason for hiding this comment

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

Good.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Oct 24, 2024
@dean-long
Copy link
Member

There's not much point in generating an incomplete replay file. How about moving the checks for this->task() to the top of the function? And we could avoid the call altogether by changing VMError::report_and_die() from:

1864      ciEnv* env = ciEnv::current();
1865      if (env != nullptr) {

to

1864      ciEnv* env = ciEnv::current();
1865      if (env != nullptr && env->task() != nullptr) {

@MBaesken
Copy link
Member Author

How about moving the checks for this->task() to the top of the function?

Makes sense, better check just once .

@openjdk openjdk bot removed the ready Pull request is ready to be integrated label Oct 25, 2024
@vnkozlov
Copy link
Contributor

I think we should do the check in VMError::report_and_die() to avoid creating empty replay file.
Note, dump_replay_data_unsafe() is called only in that one place.
An other path through dump_replay_data() call required Compilation ID which is set only when we have task.
We can use assert instead of check in ciEnv::dump_replay_data_helper().

@MBaesken
Copy link
Member Author

I think we should do the check in VMError::report_and_die() to avoid creating empty replay file. Note, dump_replay_data_unsafe() is called only in that one place. An other path through dump_replay_data() call required Compilation ID which is set only when we have task. We can use assert instead of check in ciEnv::dump_replay_data_helper().

I moved the check and added an assert .

Copy link
Contributor

@vnkozlov vnkozlov left a comment

Choose a reason for hiding this comment

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

Looks good.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Oct 28, 2024
Copy link
Contributor

@TheRealMDoerr TheRealMDoerr left a comment

Choose a reason for hiding this comment

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

LGTM.

@MBaesken
Copy link
Member Author

Hi Vladimir and Martin, thanks for the reviews !

/integrate

@openjdk
Copy link

openjdk bot commented Oct 29, 2024

Going to push as commit beff8bf.
Since your change was applied there have been 50 commits pushed to the master branch:

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Oct 29, 2024
@openjdk openjdk bot closed this Oct 29, 2024
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Oct 29, 2024
@openjdk
Copy link

openjdk bot commented Oct 29, 2024

@MBaesken Pushed as commit beff8bf.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot-compiler [email protected] integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

4 participants