jdk icon indicating copy to clipboard operation
jdk copied to clipboard

8360791: [ubsan] Adjust signal handling when using clang

Open MBaesken opened this issue 5 months ago • 4 comments

A couple of tests e.g. VendorInfoPluginsTest but also some Hotspot like runtime/ErrorHandling/CreateCoredumpOnCrash.java put (write) to special addresses like 0 to provoke crashs. However this does not work well with ubsan-enabled binaries on the clang based platforms (macOS, AIX). The mentioned tests generate a SIGSEGV.

Some other tests generate a SIGBUS, e.g.

runtime/memory/ReserveMemory.java
runtime/memory/ReadFromNoaccessArea.java

and this leads to similar issues with ubsan-enabled binaries.

We should adjust the signal handling with the sanitizer options, how to do this is documented here : https://github.com/google/sanitizers/wiki/SanitizerCommonFlags


Progress

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

Issue

  • JDK-8360791: [ubsan] Adjust signal handling when using clang (Bug - P4)

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 26015

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

Using diff file

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

Using Webrev

Link to Webrev Comment

MBaesken avatar Jun 27 '25 09:06 MBaesken

:wave: 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.

bridgekeeper[bot] avatar Jun 27 '25 09:06 bridgekeeper[bot]

@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:

8360791: [ubsan] Adjust signal handling

Reviewed-by: ihse, lucy

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 23 new commits pushed to the master branch:

  • 54c95cf2261f871c47b3700ede31390c8f5e77dd: 8361043: [ubsan] os::print_hex_dump runtime error: applying non-zero offset 8 to null pointer
  • cd6caedd0a3c9ebd4c8c57e64f62b60161c5cd7c: 8360783: CTW: Skip deoptimization between tiers
  • b32ccf2cb23e0180187f4238140583a923fc27c4: 8361092: Remove trailing spaces in x86 ad files
  • ... and 20 more: https://git.openjdk.org/jdk/compare/aa26cede635011f5cc075cd528934ce8d8e8eef9...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[bot] avatar Jun 27 '25 09:06 openjdk[bot]

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

  • build

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.

openjdk[bot] avatar Jun 27 '25 09:06 openjdk[bot]

Webrevs

mlbridge[bot] avatar Jun 27 '25 09:06 mlbridge[bot]

I wonder if this should be unconditional, rather than conditional on clang.

At least it did not do harm on Linux x86_64/gcc when making it unconditional.

MBaesken avatar Jun 27 '25 19:06 MBaesken

I wonder if this should be unconditional, rather than conditional on clang.

At least it did not do harm on Linux x86_64/gcc when making it unconditional.

I removed the clang check and made the addition unconditional.

Regarding other signals than SIGBUS and SIGSEGV I did not see issues with those in the jtreg tests.

MBaesken avatar Jun 30 '25 07:06 MBaesken

Thanks for the reviews !

/integrate

MBaesken avatar Jul 01 '25 09:07 MBaesken

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

  • 54c95cf2261f871c47b3700ede31390c8f5e77dd: 8361043: [ubsan] os::print_hex_dump runtime error: applying non-zero offset 8 to null pointer
  • cd6caedd0a3c9ebd4c8c57e64f62b60161c5cd7c: 8360783: CTW: Skip deoptimization between tiers
  • b32ccf2cb23e0180187f4238140583a923fc27c4: 8361092: Remove trailing spaces in x86 ad files
  • ... and 20 more: https://git.openjdk.org/jdk/compare/aa26cede635011f5cc075cd528934ce8d8e8eef9...master

Your commit was automatically rebased without conflicts.

openjdk[bot] avatar Jul 01 '25 09:07 openjdk[bot]

@MBaesken Pushed as commit aeca49e43fab951c2031895fee32703fb4a19524.

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

openjdk[bot] avatar Jul 01 '25 09:07 openjdk[bot]