RFR: JDK-8298448: UndefinedBehaviorSanitizer

Robbin Ehn rehn at openjdk.org
Fri Dec 9 13:29:00 UTC 2022


On Fri, 9 Dec 2022 06:53:31 GMT, Justin King <jcking at openjdk.org> wrote:

> Allow building OpenJDK with UBSan. Currently the build fails when optimizing the image due to lots of undefined behavior (it invokes the built JVM). Follow up PRs will either replace the undefined behavior with well defined behavior or suppress errors which are intentional. The goal is to make OpenJDK more well defined and thus more portable across compilers and architectures.

Two questions, this works fine for me:
`UBSAN_CFLAGS="-fsanitize=undefined -fsanitize=float-divide-by-zero -Wno-stringop-truncation -Wno-format-overflow -fno-omit-frame-pointer" ; UBSAN_LDFLAGS="-fsanitize=undefined -fsanitize=float-divide-by-zero" ; sh configure --with-conf-name=udf --with-debug-level=fastdebug --with-native-debug-symbols=internal -with-version-opt=releaserobbin --with-gtest=/home/rehn/source/gtest181/ --disable-precompiled-headers --enable-dtrace --with-extra-cflags="$UBSAN_CFLAGS" --with-extra-cxxflags="$UBSAN_CFLAGS" --with-extra-ldflags="$UBSAN_LDFLAGS" && make images CONF=udf`
I.e.build works ?

Secondly, the method __ubsan_default_options is in the java launcher.
libjvm.so is a "standalone product" that can be used by different launchers.
So I'm not sure it should be in launcher if it was needed.

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

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



More information about the build-dev mailing list