-
Notifications
You must be signed in to change notification settings - Fork 6.1k
8331854: ubsan: copy.hpp:218:10: runtime error: addition of unsigned offset to 0x7fc2b4024518 overflowed to 0x7fc2b4024510 #19541
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
Conversation
|
👋 Welcome back mbaesken! A progress list of the required criteria for merging this PR into |
|
@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: 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 17 new commits pushed to the
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 |
Webrevs
|
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.
Good. I read through comments in bug report and this fix makes sense.
|
I wonder if using for-loop works here. (Since #iterations is known, for-loop seems more natural.) for (size_t i = 0; i < count; ++i) {
to[count - 1 - i] = from[count - 1 - i];
} |
|
@albertnetymk, that rewrite seems fine, but at least to me it's less obvious what it does, and I wonder if the C++ compiler generates equivalent code. If we are going to change the loop, here's another alternative: |
|
FWIW, I was also thinking that this could be written in another way, but I held of because didn't want to derail yet another ubsan review. :) The reasons why I would have preferred if this were written another way are:
Now that people have been given alternatives, I can say that I first considered @dean-long's version. It has a drawback that the from and to names are slightly off given that they point to one beyond the current from and to elements. (With that said, this function already uses @albertnetymk's version is interesting, but I agree with Dean that it is less obvious. I wonder if this could be written something like this: |
Moved the check after the asserts. |
Given there is no consensus on how the new loop should look, it makes sense to defer that. I also think not placing |
|
/integrate |
|
Going to push as commit 2c1b311.
Your commit was automatically rebased without conflicts. |
When building with ubsan, we see a number of overflows at this code location :
/jdk/src/hotspot/share/utilities/copy.hpp:218:10: runtime error: addition of unsigned offset to 0x7fc2b4024518 overflowed to 0x7fc2b4024510
#0 0x10b70896d in Copy::conjoint_words_to_higher(HeapWordImpl* const*, HeapWordImpl**, unsigned long) copy.hpp:218
#1 0x10c4f78f1 in Node_Array::insert(unsigned int, Node*) node.cpp:2783
#2 0x10b8a1386 in Block::insert_node(Node*, unsigned int) block.hpp:134
#3 0x10c556630 in PhaseOutput::fill_buffer(C2_MacroAssembler*, unsigned int*) output.cpp:1792
#4 0x10c552f6b in PhaseOutput::Output() output.cpp:367
#5 0x10b9ba859 in Compile::Code_Gen() compile.cpp:3035
#6 0x10b9b7cb1 in Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*) compile.cpp:896
#7 0x10b859912 in C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*) c2compiler.cpp:142
#8 0x10b9dd4f1 in CompileBroker::invoke_compiler_on_method(CompileTask*) compileBroker.cpp:2305
#9 0x10b9dc345 in CompileBroker::compiler_thread_loop() compileBroker.cpp:1963
#10 0x10bfd5ebf in JavaThread::thread_main_inner() javaThread.cpp:760
#11 0x10bfd5b62 in JavaThread::run() javaThread.cpp:745
#12 0x10c9310d6 in Thread::call_run() thread.cpp:221
#13 0x10c53ece4 in thread_native_entry(Thread*) os_bsd.cpp:598
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/19541/head:pull/19541$ git checkout pull/19541Update a local copy of the PR:
$ git checkout pull/19541$ git pull https://git.openjdk.org/jdk.git pull/19541/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 19541View PR using the GUI difftool:
$ git pr show -t 19541Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/19541.diff
Webrev
Link to Webrev Comment