On Thu, 30 Mar 2023 19:50:47 GMT, Jorn Vernee <[email protected]> wrote:
>> src/java.base/share/classes/jdk/internal/foreign/abi/BindingSpecializer.java
>> line 216:
>>
>>> 214: if (PERFORM_VERIFICATION) {
>>> 215: boolean printResults = false; // only print in case of
>>> exception
>>> 216: CheckClassAdapter.verify(new ClassReader(bytes), null,
>>> printResults, new PrintWriter(System.err));
>>
>> Classfile API provides verification functionality as well, as seen here:
>> https://github.com/openjdk/jdk/blob/83cf28f99639d80e62c4031c4c9752460de5f36c/test/jdk/jdk/classfile/ClassHierarchyInfoTest.java#L105
>
> Does this provide additional verification over what is already done just by
> generating the class?
>
> For instance, IIRC the ASM verifier could catch e.g. stack underflow, but
> that seems to be caught already by the new implementation without running the
> verifier.
Yes, for instance, the class generation doesn't check operand stack underflow,
that you can generate code with invalid pops. The classfile verifier catches
this:
https://github.com/openjdk/jdk/blob/83cf28f99639d80e62c4031c4c9752460de5f36c/src/java.base/share/classes/jdk/internal/classfile/impl/verifier/VerificationFrame.java#L153
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13247#discussion_r1153732811