Closed TUGOhost closed 4 years ago
刚才又测了pixel 8.1.0 arm64-v8a是成功的,日志如下:
525 7525 I Dobby : [*] Initialize dx_hook_hookfun => 0x73b07f7144 => 0x731741f898
7525 7525 I Dobby : [*] ================ FunctionInlineReplaceRouting Start ================
7525 7525 I Dobby : [*] Set trampoline target => 0x731741f898
7525 7525 I Dobby : [*] Generate trampoline => 0x731741f898
7525 7525 I Dobby : [*] Initialize assembler code buffer at 0x732f183400
7525 7525 I Dobby : [*] Trampoline use [Adrp, Add, Br] combine
7525 7525 I Dobby : [*] Initialize assembler code buffer at 0x732f183400
7525 7525 I Dobby : [*] Finalize assembler at 0x73b312a000
7525 7525 I Dobby : [*] 0x73b07f7144 relocate 28 bytes, to 0x73b312a000
7525 7525 I Dobby : [*] Code patch 0x732f0b7f00 => 0x73b07f7144
7525 7525 I Dobby : [*] ================ InterceptRouting End ================
7525 7552 D OpenGLRenderer: HWUI GL Pipeline
7525 7552 I Adreno : QUALCOMM build : 2941438, I916dfac403
7525 7552 I Adreno : Build Date : 10/03/17
7525 7552 I Adreno : OpenGL ES Shader Compiler Version: EV031.21.02.00
7525 7552 I Adreno : Local Branch : O18A
7525 7552 I Adreno : Remote Branch :
7525 7552 I Adreno : Remote Branch :
7525 7552 I Adreno : Reconstruct Branch :
7525 7552 D Tag : Hooked
7525 7552 I chatty : uid=10128(com.example.dobbydemo) RenderThread identical 13 lines
7525 7552 D Tag : Hooked
7525 7552 I Adreno : PFP: 0x005ff087, ME: 0x005ff063
7525 7552 D Tag : Hooked
7525 7552 D Tag : Hooked
7525 7552 I zygote64: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
7525 7552 I OpenGLRenderer: Initialized EGL, version 1.4
7525 7552 D OpenGLRenderer: Swap behavior 2
1321 1321 I GoogleInputMethodService: GoogleInputMethodService.onFinishInput():3160
1321 1321 I GoogleInputMethodService: GoogleInputMethodService.onStartInput():1829
7525 7552 D Tag : Hooked
610 610 D QCOM PowerHAL: LAUNCH HINT: OFF
809 858 I ActivityManager: Displayed com.example.dobbydemo/.MainActivity: +376ms
1834 7309 I PBSessionCacheImpl: Deleted sessionId[8067618559419448] from persistence.
809 7508 I WifiService: getWifiEnabledState uid=10051
1834 2264 W SearchServiceCore: Abort, client detached.
现代码:
void HookMain() {
void * addr = get_library_address("libc.so");
size_t size = get_library_size("libc.so");
void *libc_handle;
libc_handle = dlopen("libc.so", 0);
void *ori_sym = dlsym(libc_handle, (char *)"open");
mprotect(addr, size, PROT_READ | PROT_WRITE | PROT_EXEC);
dx_hook_hookfun(ori_sym, (void *)new_print, (void **)&old_print);
mprotect(addr, size, PROT_EXEC);
}
在pixel,安卓10,arm64-v8a上可以正常hook。 上午的问题已经解决,具体这个:https://developer.android.com/about/versions/10/behavior-changes-all?hl=zh-cn#xom-binaries 日志如下: 09/28 15:23:28: Launching 'app' on Google Pixel. $ adb shell am start -n "com.example.dobbydemo/com.example.dobbydemo.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER Connected to process 12220 on device 'google-pixel-FA75R0302109'. Capturing and displaying logcat messages from application. This behavior can be disabled in the "Logcat output" section of the "Debugger" settings page. I/Dobby: [] Initialize dx_hook_hookfun => 0x707c6913ac => 0x6f914299d8 I/Dobby: [] ================ FunctionInlineReplaceRouting Start ================ [] Set trampoline target => 0x6f914299d8 [] Generate trampoline => 0x6f914299d8 [] Initialize assembler code buffer at 0x707da710e0 [] Trampoline use [Adrp, Add, Br] combine [] Initialize assembler code buffer at 0x707da710e0 [] Finalize assembler at 0x707d423000 [] 0x707c6913ac relocate 28 bytes, to 0x707d423000 [] Code patch 0x707da6c2e0 => 0x707c6913ac [*] ================ InterceptRouting End ================ W/ample.dobbydem: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (greylist, reflection, allowed) W/ample.dobbydem: Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (greylist, reflection, allowed) I/Adreno: QUALCOMM build : 4a00b69, I4e7e888065 Build Date : 04/09/19 OpenGL ES Shader Compiler Version: EV031.26.06.00 Local Branch : mybranche95ae4c8-d77f-f18d-a9ef-1458d0b52ae8 Remote Branch : quic/gfx-adreno.lnx.1.0 Remote Branch : NONE Reconstruct Branch : NOTHING Build Config : S L 8.0.5 AArch64 D/Tag: Hooked I/chatty: uid=10170(com.example.dobbydemo) RenderThread identical 12 lines D/Tag: Hooked I/Adreno: PFP: 0x005ff110, ME: 0x005ff066 D/Tag: Hooked I/chatty: uid=10170(com.example.dobbydemo) RenderThread identical 8 lines D/Tag: Hooked D/Tag: Hooked W/Gralloc3: mapper 3.x is not supported D/Tag: Hooked D/Tag: Hooked D/Tag: Hooked
我看下. 我记得我的 Android 10 没啥问题嗷, 我看过这个 10 的 mitigation
我看下. 我记得我的 Android 10 没啥问题嗷, 我看过这个 10 的 mitigation
应该是小米的问题,第一个log是redmi K20 pro 安卓10报的错,但是pixel安卓10就不会报错。我把demo的targetSdkVersion换成29以下就可以在redmi K20 pro 安卓10上用。
是的 我手里也是 pixel 10 那我回来试下 redmi
Any fixed on this? Maybe we do mprotect before hook?
测试出现的版本:安卓10,arm64-v8a。 代码:
错误日志:
在安卓6.0.1,arm32-v7a中正常运行的日志: