You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Very simple example of hooking a Java static function just to watch after its called parameter. Everything hangs after iterations on count 20.
Hooked function:
import java.io.*; // Number Formatting
public class Hello
{ // main
public static void main(String[] args)
{ int i=0;
Hello hello=new Hello();
while(true)
{
hello.f(i++);
try
{
Thread.sleep(1000); // Sleep for 1 second
}
catch (InterruptedException e)
{ System.out.println("Thread interrupted: " + e.getMessage());
Thread.currentThread().interrupt();
break;
}
}
}
// static subprogram
public static void f(int n)
{
System.out.printf("Number: %4d\n", n);
}
}
Everything hangs on count 20. After Frida quit, the java program gives the error: fatal error: Deadlock in safepoint code.
Hanging introduce itself only if the hooked function is called from the overload.
The most strange think is that it hangs exactly at count 20 even if hooking starts at different numbers. Are there any limitations in Frida for calling a Java function?
Please, help!
Number: 15
Number: 16
Number: 17
Number: 18
Number: 19
Number: 20
#
# A fatal error has been detected by the Java Runtime Environment:
#
# Internal Error (safepoint.cpp:894), pid=43398, tid=43432
# fatal error: Deadlock in safepoint code. Should have called back to the VM before blocking.
#
Frida:
[Local::java ]-> parameters: 14
parameters: 15
parameters: 16
parameters: 17
parameters: 18
parameters: 19
parameters: 20
[Local::java ]-> quit
Thank you for using Frida!
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Very simple example of hooking a Java static function just to watch after its called parameter. Everything hangs after iterations on count 20.
Hooked function:
Frida script:
Everything hangs on count 20. After Frida quit, the java program gives the error:
fatal error: Deadlock in safepoint code.Hanging introduce itself only if the hooked function is called from the overload.
The most strange think is that it hangs exactly at count 20 even if hooking starts at different numbers.
Are there any limitations in Frida for calling a Java function?
Please, help!
Environment:
Ubuntu 20.04.4 LTS
Java openjdk 11.0.25
Frida 16.4.10
Below are the resulting logs:
Java program:
Frida:
Beta Was this translation helpful? Give feedback.
All reactions