RFR: 8292657: Calling GetLocalXXX from virtual thread with thread parameter set to NULL returns carrier locals [v2]

Serguei Spitsyn sspitsyn at openjdk.org
Fri Aug 26 21:33:13 UTC 2022


> If JVM TI GetLocalXXX/SetLocalXXX is called from a virtual thread with the thread parameter set to NULL (meaning current thread) then it should get/set the value of the locals in the virtual thread frames. Instead, it reads the carrier thread locals and/or crashes.
> 
> The fix is that the relevant checking of the jthread parameter for NULL and adjusting it to current thread is added.
> It is done in new utility `function current_thread_obj_or_resolve_external_guard(jthread thread)`. For more convenient testing the same adjustment is done in the JVM TI extension function `GetCarrierThread()`.
> 
> The test serviceability/jvmti/vthread/GetSetLocalTest is updated to add previously missed test coverage.
> 
> The test serviceability/jvmti/vthread/VThreadTest has been updated to adopt to update behavior of the `GetCarrierThread`.
> 
> The fix was verified with the test/hotspot/jtreg/serviceability/jvmti/vthread/ tests.
> 
> The fix was also tested with the existing JVM TI and JDI tests to make sure no regressions are introduced.

Serguei Spitsyn has updated the pull request incrementally with one additional commit since the last revision:

  remove unneeded commented lines in test

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/10051/files
  - new: https://git.openjdk.org/jdk/pull/10051/files/56fcb6ea..7033bcb6

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=10051&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=10051&range=00-01

  Stats: 2 lines in 1 file changed: 0 ins; 2 del; 0 mod
  Patch: https://git.openjdk.org/jdk/pull/10051.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/10051/head:pull/10051

PR: https://git.openjdk.org/jdk/pull/10051


More information about the serviceability-dev mailing list