You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adds a regression test for a raw Method* access after HotspotSupport::resolve() leaves its crash-protected metadata walk.
The test makes the fake JVMTI GetClassMethods callback invalidate the page containing the original Method*. The following vm_method->validatedId() call otherwise aborts in assertion-enabled builds.
A second commit contains a candidate fix: use the existing safe load_at_offset path in VMMethod::id() so the read does not pass through VMStructs::at() and its readability assertion.
Motivation:
PR #743 protects the initial metadata walk, but the <clinit> fallback retains and reads vm_method after JNI/JVMTI work and after crash protection has been removed. This draft provides a concrete reproducer and a narrow candidate fix so the lifetime assumptions and preferred resolution can be reviewed.
Additional Notes:
The invalidation is synthetic. Whether class unloading, redefinition, or obsolete-method reclamation can produce the same timing in a live JVM still needs investigation.
Without the candidate fix, the test observes SIGABRT from the readability assertion in VMStructs::at().
The candidate fix is intentionally limited to the first VMMethod::id() load. This draft does not assume that it is the preferred final design.
Both targeted suites pass on Linux with the reproducer enabled and the candidate fix applied.
For Datadog employees:
If this PR touches code that signs or publishes builds or packages, or handles
credentials of any kind, I've requested a security review (run the dd:platform-security-review
skill, or file a request via the PSEC review form). bewaire also runs automatically on every PR.
I am confused - what's the purpose of the test? to verify that without longjmp protection, vm_method->validatedId() call can result in crash?
Current vm_method->validatedId() implementation should not crash, as all memory accesses via SafeAccess, but I intent to change to plain accesses with longjmp protection, then fault-injection should be able to trigger the crash to test longjmp recovery.
I am confused - what's the purpose of the test? to verify that without longjmp protection, vm_method->validatedId() call can result in crash?
Current vm_method->validatedId() implementation should not crash, as all memory accesses via SafeAccess, but I intent to change to plain accesses with longjmp protection, then fault-injection should be able to trigger the crash to test longjmp recovery.
The aim is to give you test cases for your refactors. There is no fix proposal here.
Enabling the reproducer demonstrates the SIGABRT in VMStructs::at() after JVMTI invalidates the raw Method* page.
I am confused - what's the purpose of the test? to verify that without longjmp protection, vm_method->validatedId() call can result in crash?
Current vm_method->validatedId() implementation should not crash, as all memory accesses via SafeAccess, but I intent to change to plain accesses with longjmp protection, then fault-injection should be able to trigger the crash to test longjmp recovery.
The aim is to give you test cases for your refactors. There is no fix proposal here. Enabling the reproducer demonstrates the SIGABRT in VMStructs::at() after JVMTI invalidates the raw Method* page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
What does this PR do?:
Adds a regression test for a raw
Method*access afterHotspotSupport::resolve()leaves its crash-protected metadata walk.The test makes the fake JVMTI
GetClassMethodscallback invalidate the page containing the originalMethod*. The followingvm_method->validatedId()call otherwise aborts in assertion-enabled builds.A second commit contains a candidate fix: use the existing safe
load_at_offsetpath inVMMethod::id()so the read does not pass throughVMStructs::at()and its readability assertion.Motivation:
PR #743 protects the initial metadata walk, but the
<clinit>fallback retains and readsvm_methodafter JNI/JVMTI work and after crash protection has been removed. This draft provides a concrete reproducer and a narrow candidate fix so the lifetime assumptions and preferred resolution can be reviewed.Additional Notes:
SIGABRTfrom the readability assertion inVMStructs::at().VMMethod::id()load. This draft does not assume that it is the preferred final design.How to test the change?:
Both targeted suites pass on Linux with the reproducer enabled and the candidate fix applied.
For Datadog employees:
credentials of any kind, I've requested a security review (run the
dd:platform-security-reviewskill, or file a request via the PSEC review form).
bewairealso runs automatically on every PR.Unsure? Have a question? Request a review!