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

Roman Kennke rkennke at openjdk.org
Tue Jul 11 11:45:35 UTC 2023


On Tue, 11 Jul 2023 10:51:53 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

> 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`

Ok. It's quite a cludge, but I can't think of a better way, either. Only one question:

src/hotspot/share/oops/oop.hpp line 374:

> 372: };
> 373: 
> 374: // Used by VMStructs when CompactObjectHeaders are enabled.

Is it possible to keep this in vmStructs.*, closer to the override?

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

Marked as reviewed by rkennke (Reviewer).

PR Review: https://git.openjdk.org/lilliput-jdk17u/pull/51#pullrequestreview-1524067504
PR Review Comment: https://git.openjdk.org/lilliput-jdk17u/pull/51#discussion_r1259610743


More information about the lilliput-dev mailing list