From 0fd44ced91dc3cdd414adf858a9890b01ecf3209 Mon Sep 17 00:00:00 2001 From: android Date: Mon, 20 Jul 2020 14:17:56 +0800 Subject: [PATCH] Release 0.6.0 --- pom.xml | 2 +- unidbg-android/pom.xml | 6 +++--- .../github/unidbg/linux/ARM32SyscallHandler.java | 14 ++++++++------ .../github/unidbg/linux/ARM64SyscallHandler.java | 14 ++++++++------ .../github/unidbg/linux/android/dvm/BaseVM.java | 9 +++++++-- unidbg-api/pom.xml | 4 ++-- unidbg-ios/pom.xml | 6 +++--- 7 files changed, 32 insertions(+), 23 deletions(-) diff --git a/pom.xml b/pom.xml index 631c0cbae..d3b8040f3 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.github.zhkl0228 unidbg-parent pom - 0.5.0 + 0.6.0 unidbg-api unidbg-android diff --git a/unidbg-android/pom.xml b/unidbg-android/pom.xml index b0194a05b..7d1d1a39c 100644 --- a/unidbg-android/pom.xml +++ b/unidbg-android/pom.xml @@ -5,17 +5,17 @@ com.github.zhkl0228 unidbg-parent - 0.5.0 + 0.6.0 4.0.0 unidbg-android - 0.6.0-SNAPSHOT + 0.6.0 com.github.zhkl0228 unidbg-api - 0.6.0-SNAPSHOT + 0.6.0 net.dongliu diff --git a/unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java b/unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java index b9f85d2f0..cf8c4c139 100644 --- a/unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java +++ b/unidbg-android/src/main/java/com/github/unidbg/linux/ARM32SyscallHandler.java @@ -326,7 +326,7 @@ public void hook(Unicorn u, int intno, Object user) { u.reg_write(ArmConst.UC_ARM_REG_R0, tkill(emulator)); return; case 240: - u.reg_write(ArmConst.UC_ARM_REG_R0, futex(u, emulator)); + u.reg_write(ArmConst.UC_ARM_REG_R0, futex(emulator)); return; case 248: exit_group(emulator); @@ -1729,10 +1729,11 @@ private int writev(Unicorn u, Emulator emulator) { private static final int FUTEX_WAIT = 0; private static final int FUTEX_WAKE = 1; - private int futex(Unicorn u, Emulator emulator) { - Pointer uaddr = UnicornPointer.register(emulator, ArmConst.UC_ARM_REG_R0); - int futex_op = ((Number) u.reg_read(ArmConst.UC_ARM_REG_R1)).intValue(); - int val = ((Number) u.reg_read(ArmConst.UC_ARM_REG_R2)).intValue(); + private int futex(Emulator emulator) { + RegisterContext context = emulator.getContext(); + Pointer uaddr = context.getPointerArg(0); + int futex_op = context.getIntArg(1); + int val = context.getIntArg(2); int old = uaddr.getInt(0); if (log.isDebugEnabled()) { log.debug("futex uaddr=" + uaddr + ", _futexop=" + futex_op + ", op=" + (futex_op & 0x7f) + ", val=" + val + ", old=" + old); @@ -1743,7 +1744,8 @@ private int futex(Unicorn u, Emulator emulator) { if (old != val) { throw new IllegalStateException("old=" + old + ", val=" + val); } - Pointer timeout = UnicornPointer.register(emulator, ArmConst.UC_ARM_REG_R3); + Thread.yield(); + Pointer timeout = context.getPointerArg(3); int mytype = val & 0xc000; int shared = val & 0x2000; if (log.isDebugEnabled()) { diff --git a/unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java b/unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java index 32f8c5543..d916d3d41 100644 --- a/unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java +++ b/unidbg-android/src/main/java/com/github/unidbg/linux/ARM64SyscallHandler.java @@ -187,7 +187,7 @@ public void hook(Unicorn u, int intno, Object user) { u.reg_write(ArmConst.UC_ARM_REG_R0, fchmod(u)); return; case 98: - u.reg_write(Arm64Const.UC_ARM64_REG_X0, futex(u, emulator)); + u.reg_write(Arm64Const.UC_ARM64_REG_X0, futex(emulator)); return; case 103888: u.reg_write(ArmConst.UC_ARM_REG_R0, syslog(u, emulator)); @@ -1511,10 +1511,11 @@ private int writev(Emulator emulator) { private static final int FUTEX_WAIT = 0; private static final int FUTEX_WAKE = 1; - private int futex(Unicorn u, Emulator emulator) { - Pointer uaddr = UnicornPointer.register(emulator, Arm64Const.UC_ARM64_REG_X0); - int futex_op = ((Number) u.reg_read(Arm64Const.UC_ARM64_REG_X1)).intValue(); - int val = ((Number) u.reg_read(Arm64Const.UC_ARM64_REG_X2)).intValue(); + private int futex(Emulator emulator) { + RegisterContext context = emulator.getContext(); + Pointer uaddr = context.getPointerArg(0); + int futex_op = context.getIntArg(1); + int val = context.getIntArg(2); int old = uaddr.getInt(0); if (log.isDebugEnabled()) { log.debug("futex uaddr=" + uaddr + ", _futexop=" + futex_op + ", op=" + (futex_op & 0x7f) + ", val=" + val + ", old=" + old); @@ -1525,7 +1526,8 @@ private int futex(Unicorn u, Emulator emulator) { if (old != val) { throw new IllegalStateException("old=" + old + ", val=" + val); } - Pointer timeout = UnicornPointer.register(emulator, Arm64Const.UC_ARM64_REG_X3); + Thread.yield(); + Pointer timeout = context.getPointerArg(3); int mytype = val & 0xc000; int shared = val & 0x2000; if (log.isDebugEnabled()) { diff --git a/unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/BaseVM.java b/unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/BaseVM.java index 4cc29e6e2..138c8fc6c 100644 --- a/unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/BaseVM.java +++ b/unidbg-android/src/main/java/com/github/unidbg/linux/android/dvm/BaseVM.java @@ -22,7 +22,7 @@ import java.security.cert.CertificateException; import java.util.*; -public abstract class BaseVM implements VM { +public abstract class BaseVM implements VM, DvmClassFactory { private static final Log log = LogFactory.getLog(BaseVM.class); @@ -83,7 +83,7 @@ public final DvmClass resolveClass(String className, DvmClass... interfaceClasse dvmClass = dvmClassFactory.createClass(this, className, interfaceClasses); } if (dvmClass == null) { - dvmClass = new DvmClass(this, className, interfaceClasses); + dvmClass = this.createClass(this, className, interfaceClasses); } classMap.put(hash, dvmClass); addObject(dvmClass, true); @@ -91,6 +91,11 @@ public final DvmClass resolveClass(String className, DvmClass... interfaceClasse return dvmClass; } + @Override + public DvmClass createClass(BaseVM vm, String className, DvmClass[] interfaceClasses) { + return new DvmClass(vm, className, interfaceClasses); + } + final int addObject(DvmObject object, boolean global) { if (object == null) { return 0; diff --git a/unidbg-api/pom.xml b/unidbg-api/pom.xml index 65029f795..415965db6 100644 --- a/unidbg-api/pom.xml +++ b/unidbg-api/pom.xml @@ -5,12 +5,12 @@ com.github.zhkl0228 unidbg-parent - 0.5.0 + 0.6.0 4.0.0 unidbg-api - 0.6.0-SNAPSHOT + 0.6.0 com.github.zhkl0228 diff --git a/unidbg-ios/pom.xml b/unidbg-ios/pom.xml index 56e72aea3..bb79c2263 100644 --- a/unidbg-ios/pom.xml +++ b/unidbg-ios/pom.xml @@ -5,17 +5,17 @@ com.github.zhkl0228 unidbg-parent - 0.5.0 + 0.6.0 4.0.0 unidbg-ios - 0.6.0-SNAPSHOT + 0.6.0 com.github.zhkl0228 unidbg-api - 0.6.0-SNAPSHOT + 0.6.0 io.kaitai