-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
I tried this poc on 4e75367
And it seems like error occurs when using mem_map with more than 0x100000 size after calling the vm.loadLibrary.
poc is here:
public static void main(String[] args)
{
emulator = AndroidEmulatorBuilder
.for64Bit()
.addBackendFactory(new Unicorn2Factory(true))
.setProcessName("bugpoc")
.setRootDir(new File("unidbg-android/src/test/resources/VFS"))
.build();
Memory memory = emulator.getMemory();
memory.setLibraryResolver(new AndroidResolver(26));
vm = emulator.createDalvikVM();
vm.setVerbose(true);
vm.loadLibrary(new File("unidbg-master\\unidbg-android\\target\\classes\\android\\sdk23\\lib64\\libc.so"),false);
Backend backend = emulator.getBackend();
backend.mem_map(0x20f000, 0x101000, 0);
backend.mem_protect(0x20f000, 0x2000, 3);
}
the error message is
Exception in thread "main" com.github.unidbg.arm.backend.BackendException: mem_protect address=0x20f000, size=8192, perms=0x3 at com.github.unidbg.arm.backend.Unicorn2Backend.mem_protect(Unicorn2Backend.java:147) at com.test.BugPoc.main(BugPoc.java:70) Caused by: unicorn.UnicornException: No memory available or memory not present (UC_ERR_NOMEM) at com.github.unidbg.arm.backend.unicorn.Unicorn.mem_protect(Native Method) at com.github.unidbg.arm.backend.unicorn.Unicorn.mem_protect(Unicorn.java:249) at com.github.unidbg.arm.backend.Unicorn2Backend.mem_protect(Unicorn2Backend.java:145) ... 1 more