8371918: aarch64: Incorrect pointer dereference in TemplateInterpreterGenerator::generate_native_entry #28327
+0
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
…rGenerator::generate_native_entry
I believe there's a incorrect pointer deference in
TemplateInterpreterGenerator::generate_native_entry()in this part of the code:If I understand this correctly, the entry point for unsatisfied link error is loaded into
rscratch2. The next instruction,ldr(rscratch2, rscratch2), dereferences that pointer and reads from the text segment the initial instructions at the entry point intorscratch2. It then compares the native method entry point inr10with the initial instructions loaded intorscratch2which will never match. I believe the intent here was to compare the native method entry point with the unsatisfied link error entry point and theldr(rscratch2, rscratch2)instruction should be removed.This was found on OpenBSD/aarch64. OpenBSD has a security feature where the text segments are marked execute only and do not allow reads independent of execution. the
ldr(rscratch2, rscratch2)instruction causes a segfault because it is reading the text segment. While this bug was found on OpenBSD I believe it applies to all OS on aaarch64.This change removes the errant aarch64 hotspot assembly instruction that was reading from libjvm.so .text segment.
Updated comment with markdown for code.
Progress
Issue
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/28327/head:pull/28327$ git checkout pull/28327Update a local copy of the PR:
$ git checkout pull/28327$ git pull https://git.openjdk.org/jdk.git pull/28327/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 28327View PR using the GUI difftool:
$ git pr show -t 28327Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/28327.diff
Using Webrev
Link to Webrev Comment