RFR: 8320396: Class-File API ClassModel::verify should include checks from hotspot/share/classfile/classFileParser.cpp [v2]

Adam Sotona asotona at openjdk.org
Fri Mar 22 08:29:24 UTC 2024


On Thu, 21 Mar 2024 14:40:37 GMT, Adam Sotona <asotona at openjdk.org> wrote:

>> ClassFile API `jdk.internal.classfile.verifier.VerifierImpl` performed only bytecode-level class verification.
>> This patch adds `jdk.internal.classfile.verifier.ParserVerifier` with additional class checks inspired by `hotspot/share/classfile/classFileParser.cpp`.
>> 
>> Also new `VerifierSelfTest::testParserVerifier` has been added.
>> 
>> Please review.
>> 
>> Thanks,
>> Adam
>
> Adam Sotona has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 26 commits:
> 
>  - Merge remote-tracking branch 'openjdk/master' into JDK-8320396-verifier-extension
>  - work in progress
>  - work in progress
>  - work in progress
>  - work in progress
>  - work in progress
>  - removed string templates from test
>  - work in progress
>  - work in progress
>  - work in progress
>  - ... and 16 more: https://git.openjdk.org/jdk/compare/e41bc42d...54c4e9b9

Verification is an optional feature of Class-File API, however it is critical for development and testing of the Class-File API itself and all frameworks and libraries built on top of it.
`ClassFile::verify` is now focused on JVMS chapter 6 only, however the goal is to give user a bit more confidence that any class file passing the `ClassFile::verify` is correct.
Loading of the generated or transformed classes to verify them is not feasible in many situations and `ClassFile::verify` tries to give user at least some information, similar to ASM `CheckClassAdapter`or BCEL `Verifier`.

The work is also related to [JDK-8182774 Verify code in javap](https://bugs.openjdk.org/browse/JDK-8182774).

I'll add references to the relevant JVMS chapters.
Thank you for the review.

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

PR Comment: https://git.openjdk.org/jdk/pull/16809#issuecomment-2014600028


More information about the core-libs-dev mailing list