pascal-lab/Tai-e

Could not resolve java.lang.invoke.StringConcatFactory when test Java9StringConcat

Opened this issue · 1 comments

Overall Description

Hi

when I test the Java9StringConcat test case, I have trigger the plugin Java9StringConcatHandler.

There is a checker (Java9StringConcatHandler) before enter the login in Java9StringConcatHandler.

        JMethod bsm = ((InvokeDynamic) invoke.getInvokeExp())
                .getBootstrapMethodRef()
                .resolveNullable();
        if (bsm != null) {
            String bsmSig = bsm.getSignature();
            return bsmSig.equals(Signatures.STRING_CONCAT_FACTORY_MAKE);
        } else {
            return false;
        }

And the result of variable bsm is null, so could not active the real logic in the plugin.

Current Behavior

could not result right In testing Java9StringConcat

Expected Behavior

https://github.com/pascal-lab/Tai-e/blob/master/src/test/resources/pta/taint/Java9StringConcat-pta-expected.txt

Tai-e Version

4c6b337

Tai-e Arguments

-ap
-java
17
-acp
/test-java9-concat
-a
"pta=cs:2-call;only-app:false;implicit-entries:false;taint-config:taint-config-test.yml;handle-invokedynamic:true;dump:true"
-a
"ir-dumper"

JDK Version

1.8.0, but i use IntelliJ IDEA to run / debug

System Environment

MacOS 13

Additional Information

only-app:true also not detect this case.

Because the really loaded jars is under directory java-benchmars/JRES/jre1.8/, so I think In my context, could not find and resolve the below JDK 9 method:
<java.lang.invoke.StringConcatFactory: java.lang.invoke.CallSite makeConcatWithConstants(java.lang.invoke.MethodHandles$Lookup,java.lang.String,java.lang.invoke.MethodType,java.lang.String,java.lang.Object[])>

How to let my analyzer could recognize it. maybe a little confuse, thanks first!

The -java argument loading packaged jre from java-benchmark submodule. Currently, java 17 is not in java-benchmark, so Tai-e just ignore the -java 17 you passed. I suggest to use -pp (--prepend-JVM, see the doc) and use JDK 17 to run Tai-e.

Sorry for the inconvenient here.