Re: RFR: JDK-8298448: UndefinedBehaviorSanitizer [v10]

2023-01-12 Thread Magnus Ihse Bursie
On Sat, 17 Dec 2022 06:39:48 GMT, Justin King 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 >> behav

Re: RFR: JDK-8298448: UndefinedBehaviorSanitizer [v10]

2023-01-05 Thread Justin King
On Sat, 17 Dec 2022 06:39:48 GMT, Justin King 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 >> behav

Re: RFR: JDK-8298448: UndefinedBehaviorSanitizer [v8]

2023-01-04 Thread Robbin Ehn
On Fri, 16 Dec 2022 16:10:10 GMT, Magnus Ihse Bursie wrote: >> Justin King has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Simplify logic for including __ubsan_default_options >> >> Signed-off-by: Justin King > > I much also check:

Re: RFR: JDK-8298448: UndefinedBehaviorSanitizer [v10]

2023-01-04 Thread Justin King
On Sat, 17 Dec 2022 06:39:48 GMT, Justin King 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 >> behav

Re: RFR: JDK-8298448: UndefinedBehaviorSanitizer [v9]

2022-12-16 Thread Justin King
On Sat, 17 Dec 2022 06:33:43 GMT, Justin King 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 >> behav

Re: RFR: JDK-8298448: UndefinedBehaviorSanitizer [v8]

2022-12-16 Thread Justin King
On Fri, 16 Dec 2022 15:56:44 GMT, Magnus Ihse Bursie wrote: > However, I do think the included source files should be treated like the > autoheaders, and reside in data rather than in `src`. The latter is intended > for buildtools, even though they are a bit scattered at the moment (there is >

Re: RFR: JDK-8298448: UndefinedBehaviorSanitizer [v10]

2022-12-16 Thread Justin King
> 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 t

Re: RFR: JDK-8298448: UndefinedBehaviorSanitizer [v9]

2022-12-16 Thread Justin King
> 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 t

Re: RFR: JDK-8298448: UndefinedBehaviorSanitizer [v8]

2022-12-16 Thread Magnus Ihse Bursie
On Mon, 12 Dec 2022 10:42:22 GMT, Justin King 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 >> behav

Re: RFR: JDK-8298448: UndefinedBehaviorSanitizer [v8]

2022-12-16 Thread Magnus Ihse Bursie
On Fri, 9 Dec 2022 20:38:26 GMT, Erik Joelsson wrote: >> make/autoconf/jdk-options.m4 line 450: >> >>> 448: >>> ### >>> 449: # >>> 450: # UndefinedBehaviorSanitizer >> >> I think this logic fits better in `flags.m4`, o

Re: RFR: JDK-8298448: UndefinedBehaviorSanitizer [v8]

2022-12-16 Thread Magnus Ihse Bursie
On Mon, 12 Dec 2022 10:42:22 GMT, Justin King 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 >> behav

Re: RFR: JDK-8298448: UndefinedBehaviorSanitizer [v8]

2022-12-13 Thread Justin King
On Tue, 13 Dec 2022 16:55:09 GMT, Robbin Ehn wrote: > > I guess the advantage to putting this in the build machinery (as opposed to > > using `--with-extra-cflags=-fsanitize=undefined > > --with-extra-ldflags=-fsanitize=undefined`) is that we can turn some of > > these onn by default once we'v

Re: RFR: JDK-8298448: UndefinedBehaviorSanitizer [v8]

2022-12-13 Thread Erik Joelsson
On Tue, 13 Dec 2022 13:45:04 GMT, Justin King wrote: > Nope. Some targets end up passing C++ flags to the C compiler, causing a > failure. Ah right, we (mis)use CFLAGS (instead of CXXFLAGS) in some SetupNativeCompilation calls when all source files are C++. In that case, your suggested patch

Re: RFR: JDK-8298448: UndefinedBehaviorSanitizer [v8]

2022-12-13 Thread Robbin Ehn
On Tue, 13 Dec 2022 16:29:59 GMT, Justin King wrote: > I guess the advantage to putting this in the build machinery (as opposed to > using `--with-extra-cflags=-fsanitize=undefined > --with-extra-ldflags=-fsanitize=undefined`) is that we can turn some of these > onn by default once we've fixed

Re: RFR: JDK-8298448: UndefinedBehaviorSanitizer [v8]

2022-12-13 Thread Justin King
On Mon, 12 Dec 2022 10:42:22 GMT, Justin King 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 >> behav

Re: RFR: JDK-8298448: UndefinedBehaviorSanitizer [v8]

2022-12-13 Thread Andrew Haley
On Mon, 12 Dec 2022 10:42:22 GMT, Justin King 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 >> behav

Re: RFR: JDK-8298448: UndefinedBehaviorSanitizer [v8]

2022-12-13 Thread Justin King
On Mon, 12 Dec 2022 10:42:22 GMT, Justin King 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 >> behav

Re: RFR: JDK-8298448: UndefinedBehaviorSanitizer [v8]

2022-12-13 Thread Erik Joelsson
On Tue, 13 Dec 2022 08:17:09 GMT, Justin King wrote: > I tried to use a single file, but the build logic attempts to compile as > either C or C++ based on file extensions, and has logic based on it. So if I > use `.cpp` and the target is all `.c` odd things happen. The same for the > inverse.

Re: RFR: JDK-8298448: UndefinedBehaviorSanitizer [v8]

2022-12-13 Thread Justin King
On Mon, 12 Dec 2022 10:42:22 GMT, Justin King 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 >> behav

Re: RFR: JDK-8298448: UndefinedBehaviorSanitizer [v8]

2022-12-12 Thread David Holmes
On Mon, 12 Dec 2022 10:42:22 GMT, Justin King 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 >> behav

Re: RFR: JDK-8298448: UndefinedBehaviorSanitizer [v3]

2022-12-12 Thread Justin King
On Tue, 13 Dec 2022 00:37:42 GMT, David Holmes wrote: >> Primarily, but its not a requirement. We should also be able to invoke >> `java` as is. The environment variables should be used to force specific >> behavior for a single invocation. Otherwise, if one forgets to pass the >> environment

Re: RFR: JDK-8298448: UndefinedBehaviorSanitizer [v3]

2022-12-12 Thread David Holmes
On Mon, 12 Dec 2022 08:04:57 GMT, Justin King wrote: >> src/java.base/share/native/launcher/main.c line 41: >> >>> 39: // extremely early during library loading, before main is called. We >>> need to override the default >>> 40: // options because by default UBSan only prints a warning for each

Re: RFR: JDK-8298448: UndefinedBehaviorSanitizer [v3]

2022-12-12 Thread Justin King
On Mon, 12 Dec 2022 09:58:54 GMT, Justin King wrote: >> src/java.base/share/native/launcher/main.c line 49: >> >>> 47: #endif // UNDEFINED_BEHAVIOR_SANITIZER >>> 48: >>> 49: /* >> >> As I said we have more launcher than 'java', if you put this method here you >> must put it in all launchers.

Re: RFR: JDK-8298448: UndefinedBehaviorSanitizer [v8]

2022-12-12 Thread Justin King
> 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 t

Re: RFR: JDK-8298448: UndefinedBehaviorSanitizer [v7]

2022-12-12 Thread Justin King
> 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 t

Re: RFR: JDK-8298448: UndefinedBehaviorSanitizer [v6]

2022-12-12 Thread Justin King
On Mon, 12 Dec 2022 09:50:33 GMT, Justin King 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 >> behav

Re: RFR: JDK-8298448: UndefinedBehaviorSanitizer [v3]

2022-12-12 Thread Justin King
On Mon, 12 Dec 2022 08:14:51 GMT, Robbin Ehn wrote: >> Justin King has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Add comment explaining __ubsan_default_options and UBSAN_OPTIONS >> >> Signed-off-by: Justin King > > src/java.base/

Re: RFR: JDK-8298448: UndefinedBehaviorSanitizer [v6]

2022-12-12 Thread Justin King
> 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 t

Re: RFR: JDK-8298448: UndefinedBehaviorSanitizer [v5]

2022-12-12 Thread Justin King
> 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 t

Re: RFR: JDK-8298448: UndefinedBehaviorSanitizer [v4]

2022-12-12 Thread Justin King
> 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 t

Re: RFR: JDK-8298448: UndefinedBehaviorSanitizer [v3]

2022-12-12 Thread Robbin Ehn
On Mon, 12 Dec 2022 07:02:04 GMT, Justin King 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 >> behav

Re: RFR: JDK-8298448: UndefinedBehaviorSanitizer [v3]

2022-12-12 Thread Justin King
On Mon, 12 Dec 2022 07:26:21 GMT, David Holmes wrote: >> Justin King has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Add comment explaining __ubsan_default_options and UBSAN_OPTIONS >> >> Signed-off-by: Justin King > > src/java.bas

Re: RFR: JDK-8298448: UndefinedBehaviorSanitizer [v3]

2022-12-11 Thread David Holmes
On Mon, 12 Dec 2022 07:02:04 GMT, Justin King 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 >> behav

Re: RFR: JDK-8298448: UndefinedBehaviorSanitizer [v2]

2022-12-11 Thread Justin King
On Mon, 12 Dec 2022 06:48:25 GMT, David Holmes wrote: >> Justin King has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Remove UBSAN_ENABLED From spec.gmk.in > > src/java.base/share/native/launcher/main.c line 38: > >> 36: >> 37: #ifdef U

Re: RFR: JDK-8298448: UndefinedBehaviorSanitizer [v3]

2022-12-11 Thread Justin King
On Mon, 12 Dec 2022 06:47:44 GMT, David Holmes wrote: >> Yeah, it is unfortunate. However there is no other way to actually set the >> defaults nicely. The other alternative is to use environment variables, but >> they are easy to forget when invoking the launcher manually. > > Does the env-var

Re: RFR: JDK-8298448: UndefinedBehaviorSanitizer [v3]

2022-12-11 Thread Justin King
> 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 t

Re: RFR: JDK-8298448: UndefinedBehaviorSanitizer [v2]

2022-12-11 Thread David Holmes
On Mon, 12 Dec 2022 05:59:19 GMT, Justin King 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 >> behav

Re: RFR: JDK-8298448: UndefinedBehaviorSanitizer [v2]

2022-12-11 Thread David Holmes
On Mon, 12 Dec 2022 05:51:52 GMT, Justin King wrote: >> src/java.base/share/native/launcher/main.c line 37: >> >>> 35: #include "jni.h" >>> 36: >>> 37: #ifdef UNDEFINED_BEHAVIOR_SANITIZER >> >> I really do not like having to make source code changes to accommodate these >> kinds of tools. > >

Re: RFR: JDK-8298448: UndefinedBehaviorSanitizer [v2]

2022-12-11 Thread David Holmes
On Mon, 12 Dec 2022 04:34:07 GMT, David Holmes wrote: >>> I think it requires much broader discussion as to whether OpenJDK is >>> actively seen to endorse these tools. Why these tools? What if there are >>> other tools, should we support them all? >>> >>> I'm not saying use of these tools may

Re: RFR: JDK-8298448: UndefinedBehaviorSanitizer [v2]

2022-12-11 Thread Justin King
On Mon, 12 Dec 2022 04:34:07 GMT, David Holmes wrote: >>> I think it requires much broader discussion as to whether OpenJDK is >>> actively seen to endorse these tools. Why these tools? What if there are >>> other tools, should we support them all? >>> >>> I'm not saying use of these tools may

Re: RFR: JDK-8298448: UndefinedBehaviorSanitizer [v2]

2022-12-11 Thread Justin King
On Mon, 12 Dec 2022 01:29:14 GMT, David Holmes wrote: >> Justin King has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Remove UBSAN_ENABLED From spec.gmk.in > > src/java.base/share/native/launcher/main.c line 37: > >> 35: #include "jni.h"

Re: RFR: JDK-8298448: UndefinedBehaviorSanitizer [v2]

2022-12-11 Thread Justin King
On Mon, 12 Dec 2022 05:02:12 GMT, David Holmes wrote: >> make/autoconf/spec.gmk.in line 459: >> >>> 457: >>> 458: # UndefinedBehaviorSanitizer >>> 459: UBSAN_ENABLED:=@UBSAN_ENABLED@ >> >> I don't see anything reading this. ?? > > To be clear there was a reason that `ASAN_ENABLED` was original

Re: RFR: JDK-8298448: UndefinedBehaviorSanitizer [v2]

2022-12-11 Thread Justin King
On Mon, 12 Dec 2022 05:48:41 GMT, Justin King wrote: >>> I think it requires much broader discussion as to whether OpenJDK is >>> actively seen to endorse these tools. Why these tools? What if there are >>> other tools, should we support them all? >>> >>> I'm not saying use of these tools may

Re: RFR: JDK-8298448: UndefinedBehaviorSanitizer [v2]

2022-12-11 Thread Justin King
On Mon, 12 Dec 2022 03:26:15 GMT, Justin King wrote: >> I think it requires much broader discussion as to whether OpenJDK is >> actively seen to endorse these tools. Why these tools? What if there are >> other tools, should we support them all? >> >> I'm not saying use of these tools may not b

Re: RFR: JDK-8298448: UndefinedBehaviorSanitizer [v2]

2022-12-11 Thread Justin King
> 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 t

Re: RFR: JDK-8298448: UndefinedBehaviorSanitizer

2022-12-11 Thread David Holmes
On Fri, 9 Dec 2022 06:53:31 GMT, Justin King 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 o

Re: RFR: JDK-8298448: UndefinedBehaviorSanitizer

2022-12-11 Thread David Holmes
On Mon, 12 Dec 2022 01:27:43 GMT, David Holmes 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 >> beha

Re: RFR: JDK-8298448: UndefinedBehaviorSanitizer

2022-12-11 Thread David Holmes
On Mon, 12 Dec 2022 03:26:15 GMT, Justin King wrote: >> I think it requires much broader discussion as to whether OpenJDK is >> actively seen to endorse these tools. Why these tools? What if there are >> other tools, should we support them all? >> >> I'm not saying use of these tools may not b

Re: RFR: JDK-8298448: UndefinedBehaviorSanitizer

2022-12-11 Thread Justin King
On Mon, 12 Dec 2022 01:31:38 GMT, David Holmes wrote: > I think it requires much broader discussion as to whether OpenJDK is actively > seen to endorse these tools. Why these tools? What if there are other tools, > should we support them all? > > I'm not saying use of these tools may not be us

Re: RFR: JDK-8298448: UndefinedBehaviorSanitizer

2022-12-11 Thread David Holmes
On Fri, 9 Dec 2022 06:53:31 GMT, Justin King 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 o

Re: RFR: JDK-8298448: UndefinedBehaviorSanitizer

2022-12-09 Thread Erik Joelsson
On Fri, 9 Dec 2022 14:34:37 GMT, Erik Joelsson 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 >> beha

Re: RFR: JDK-8298448: UndefinedBehaviorSanitizer

2022-12-09 Thread Erik Joelsson
On Fri, 9 Dec 2022 06:53:31 GMT, Justin King 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 o

Re: RFR: JDK-8298448: UndefinedBehaviorSanitizer

2022-12-09 Thread Andrew Haley
On Fri, 9 Dec 2022 06:53:31 GMT, Justin King 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 o

Re: RFR: JDK-8298448: UndefinedBehaviorSanitizer

2022-12-09 Thread Andrew Haley
On Fri, 9 Dec 2022 14:16:19 GMT, Robbin Ehn wrote: > > What version of GCC are you using? > > gcc 11.3 with libubsan 11.2 > > Also it seem to big overlap with -Wcast-align(=strict) for the > warnings/errors I see and I do like that warning. Do you have an idea if the > coverage are pretty muc

Re: RFR: JDK-8298448: UndefinedBehaviorSanitizer

2022-12-09 Thread Erik Joelsson
On Fri, 9 Dec 2022 06:53:31 GMT, Justin King 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 o

Re: RFR: JDK-8298448: UndefinedBehaviorSanitizer

2022-12-09 Thread Robbin Ehn
On Fri, 9 Dec 2022 13:46:07 GMT, Justin King wrote: > What version of GCC are you using? gcc 11.3 with libubsan 11.2 Also it seem to big overlap with -Wcast-align(=strict) for the warnings/errors I see and I do like that warning. Do you have an idea if the coverage are pretty much the same for

Re: RFR: JDK-8298448: UndefinedBehaviorSanitizer

2022-12-09 Thread Justin King
On Fri, 9 Dec 2022 06:53:31 GMT, Justin King 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 o

Re: RFR: JDK-8298448: UndefinedBehaviorSanitizer

2022-12-09 Thread Robbin Ehn
On Fri, 9 Dec 2022 06:53:31 GMT, Justin King 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 o