zhkl0228 / unidbg

Allows you to emulate an Android native library, and an experimental iOS emulation
Apache License 2.0
3.88k stars 966 forks source link

文件访问报错Negative seek offset #493

Open yzsxwp opened 2 years ago

yzsxwp commented 2 years ago

访问apk文件,无论在rootdir还是重定向都报错。网上查了说是文件格式问题,但该apk能直接安装到手机上,格式应该没问题。 运行的so是64位的,该apk下只有arm64-v8a的lib,我换其他版本运行32位的so是正常的 java.lang.IllegalStateException: java.io.IOException: Negative seek offset at com.github.unidbg.linux.AndroidElfLoader.mmap2(AndroidElfLoader.java:776) at com.github.unidbg.linux.ARM64SyscallHandler.mmap(ARM64SyscallHandler.java:1218) at com.github.unidbg.linux.ARM64SyscallHandler.hook(ARM64SyscallHandler.java:299) at com.github.unidbg.arm.backend.UnicornBackend$11.hook(UnicornBackend.java:345) at unicorn.Unicorn$NewHook.onInterrupt(Unicorn.java:128) at unicorn.Unicorn.emu_start(Native Method) at com.github.unidbg.arm.backend.UnicornBackend.emu_start(UnicornBackend.java:376) at com.github.unidbg.AbstractEmulator.emulate(AbstractEmulator.java:380) at com.github.unidbg.thread.Function64.run(Function64.java:39) at com.github.unidbg.thread.MainTask.dispatch(MainTask.java:19) at com.github.unidbg.thread.UniThreadDispatcher.run(UniThreadDispatcher.java:172) at com.github.unidbg.thread.UniThreadDispatcher.runMainForResult(UniThreadDispatcher.java:96) at com.github.unidbg.AbstractEmulator.runMainForResult(AbstractEmulator.java:340) at com.github.unidbg.arm.AbstractARM64Emulator.eFunc(AbstractARM64Emulator.java:236) at com.github.unidbg.Module.emulateFunction(Module.java:163) at com.github.unidbg.linux.LinuxModule.callFunction(LinuxModule.java:258) at com.meituan.android.common.mtguard.NBridge.call_main1(NBridge.java:69) at com.meituan.android.common.mtguard.NBridge.init(NBridge.java:58) at com.meituan.android.common.mtguard.NBridge.main(NBridge.java:53) Caused by: java.io.IOException: Negative seek offset at java.base/java.io.RandomAccessFile.seek(RandomAccessFile.java:589) at com.github.unidbg.linux.file.SimpleFileIO.getMmapData(SimpleFileIO.java:142) at com.github.unidbg.file.AbstractFileIO.mmap2(AbstractFileIO.java:123) at com.github.unidbg.linux.AndroidElfLoader.mmap2(AndroidElfLoader.java:766) ... 18 more

kevinsir commented 1 year ago

我也是,64位的apk貌似就出这个 Negative seek offset

zdf8122 commented 11 months ago

同上,64位apk必现,32位没有

zhkl0228 commented 11 months ago

需要提供样本代码才能检查

Pan-an commented 9 months ago

请问这个问题解决了吗 求教