-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
8340801: Disable ubsan checks in some awt/2d coding #21184
base: master
Are you sure you want to change the base?
Conversation
👋 Welcome back mbaesken! A progress list of the required criteria for merging this PR into |
❗ This change is not yet ready to be integrated. |
Webrevs
|
jni_md.h seems like a pretty big sledgehammer for something that seems to only be in one file, for just java.desktop. Is this macro planned to be used outside of java.desktop? |
Yes I have a couple (currently 2) more I would like to exclude as well . |
Maybe we can offer a separate header ub.hpp next to jni_md.h that contains the macro/attribute stuff. |
Alright, if this is planned to be used across the entire JDK and not just in java.desktop then I guess this should be ok. Indeed, perhaps a ubsan.h header would be appropriate for a macro like this. I'll leave that up to further discussion |
/reviewers 3 reviewers This needs careful thinking about by various parties. Until there's solid committed support by the leads of the build team I don't think we should be considering these kinds of PRs. |
What 'build team' are you talking about ? Some Oracle internal build team?
We use and run this regularly on SUSE and Ubuntu Linux and have VERY good experience with it. It works (at least on recent Linux distros) very well. (on macOS our experience is a bit different there I had a couple of issues with ubsan) and btw. Oracle blogs happily about it too and recommends it |
Erik and Magnus are indeed part of the build team. Erik is the Skara tool lead but does build work as well, while Magnus is pretty much the face of the build team at this point
I do wish MSYS2/gcc supported it as well. It could help me catch Windows bugs too
If only I could be a competent reviewer one of these days :( |
Btw regarding the function/method exclusion, this was introduced in HS some time ago |
|
Hi David, should I introduce a separate ub.hpp (similar to what we have in Hotspot) ? |
As previously discussed above a separate header would be best, though I'm not sure where it would be placed if you are using this across code in different modules. |
@MBaesken my understanding is that src/java.base/share/native/include is for exported header files, it is not a general location to put this new header. |
Seems the include directories |
That is header files for libjava. This is why I said it would be hard to find a shared location where this can be used across different modules - because there presently isn't one. |
In practise the headers from there go into a lot of libs across the whole jdk C codebase. So maybe jni_util.h / jni_util_md.h itself is a place where this can be put. Or a header located beside it . |
jni_util.h is used across all modules but it is located in I think you could probably place ub.h along-side jni_util.h in that directory. |
I moved the header to the better location. |
The UBSan functionality is well supported, as such, in the build system. As you say, actually building and running a JDK with UBSan functionality is not trivial. This just means that we are unlikely to e.g. run it continuously on our CI in the foreseeable future, not that any changes towards improving support for detecting undefined behavior should be stopped. |
As a general note, we have discussed multiple times if, or rather how, we could have a generic library that is shared by native code across all Java modules, and Hotspot code alike, but no satisfactory solution has been found as of yet. In this particular case, where all that is needed is an additional header file, I think the currently suggested solution of putting it in libjava makes sense. The majority of other JDK native libraries already depend on libjava. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From a build point of view, this looks good.
I'm not commenting if it is correct to disable ub checking for DEFINE_SOLID_DRAWGLYPHLISTAA
instead of trying to fix them.
We are running it for some weeks now at least once a week in our central builds/tests (so far only on Linux x86_64). |
That is good to hear. Kudos to you for all your hard work on getting it there! |
Hi David, are you fine with the latest version ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do wonder why the header both here and inside HotSpot is named ub.h instead of ubsan.h. Latter sounds better to me, but it doesn't really matter much
I agree it would have probably been better from the start, but at this point consistency with hotspot is more important. |
In the review of the HS PR ubsan.hpp was discussed |
Not a review, just commenting. I very much support the work @MBaesken has done with ubsan in HotSpot. There are currently four uses of the disabling attribute in HotSpot. Two are My only complaint has been a tendency to be a bit too quick to reach for the |
There is some old awt/2d coding where warnings occur when running with ubsan enabled binaries.
However at most of these locations the coding should work (at least on our supported platform set) so the warnings can be disabled at least for now.
The change adds a macro ATTRIBUTE_NO_UBSAN similar to what we already use in Hotspot coding.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/21184/head:pull/21184
$ git checkout pull/21184
Update a local copy of the PR:
$ git checkout pull/21184
$ git pull https://git.openjdk.org/jdk.git pull/21184/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 21184
View PR using the GUI difftool:
$ git pr show -t 21184
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/21184.diff
Webrev
Link to Webrev Comment