RFR: 6726901: JDWP: ReferenceType.GetValues crashes jvm in case non-static fields are passed [v2]

Chris Plummer cjplummer at openjdk.org
Mon Nov 25 21:36:38 UTC 2024


On Thu, 21 Nov 2024 21:26:01 GMT, Adam Bruce <duke at openjdk.org> wrote:

>> This PR fixes a long-standing bug in JDWP where the access flags of a field are not checked before attempting to read it's value. 
>> 
>> Prior to this change, attempting to read a non-static field would cause a JVM crash, this change corrects that behaviour by returning `INVALID_FIELDID` instead.
>> 
>> This is my first PR to OpenJDK, so please let me know if I've made any mistakes in the process.
>> 
>> Cheers,
>> Adam
>
> Adam Bruce has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Move static check to sharedGetFieldValues, add JDWP tests

test/hotspot/jtreg/vmTestbase/nsk/share/jdwp/ReplyPacket.java line 149:

> 147:         }
> 148:     }
> 149: 

Rather than adding this, you could have the test call getReply(), which is implemented in the TestDebuggerType1 superclass. This would replace a lot of code in the test, including the allocation of the ReplyPacket, the call to transport.read(), the verification of the packet, and the logging.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/22280#discussion_r1857371671


More information about the serviceability-dev mailing list