[lilliput-jdk17u:lilliput] RFR: 8311866: [Lilliput/JDK17] Disallow accessing oop metadata vmStructs with +UCOH

Aleksey Shipilev shade at openjdk.org
Tue Jul 11 11:01:33 UTC 2023


Allowing external tools to access e.g. `oopDesc::_metadata._klass` with `+UCOH` is error-prone. We have seen async-profiler poking into this field to resolve classes: https://github.com/async-profiler/async-profiler/blob/117594bb4d1ce61b073c8a9cea438b33f3f09c81/src/vmStructs.cpp#L158-L161

This hides the fields from vmStructs with +UCOH. This is the least intrusive way of achieving this I can come up with.

Additional testing:
 - [x] Eyeballing instrumented async-profiler initialization path
 - [x] Linux x86_64 fastdebug `serviceability/sa`, default
 - [x] Linux x86_64 fastdebug `serviceability/sa`, `+UCOH`
 - [ ] Linux x86_64 fastdebug `tier1 tier2`, default
 - [ ] Linux x86_64 fastdebug `tier1 tier2`, `+UCOH`

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

Commit messages:
 - Potential build failure fixes
 - Better fakery
 - Try to fake the oopDesc properly
 - Remove debug printout
 - Fix

Changes: https://git.openjdk.org/lilliput-jdk17u/pull/51/files
 Webrev: https://webrevs.openjdk.org/?repo=lilliput-jdk17u&pr=51&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8311866
  Stats: 49 lines in 4 files changed: 49 ins; 0 del; 0 mod
  Patch: https://git.openjdk.org/lilliput-jdk17u/pull/51.diff
  Fetch: git fetch https://git.openjdk.org/lilliput-jdk17u.git pull/51/head:pull/51

PR: https://git.openjdk.org/lilliput-jdk17u/pull/51


More information about the lilliput-dev mailing list