jmpews / Dobby

a lightweight, multi-platform, multi-architecture hook framework.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

closure_bridge_template LR 寄存器保存错误

ByteSecurity opened this issue · comments

环境:

XR, ios 14.7, arm64

问题

在arm64 closure_bridge_template 实现中, 直接使用 xASM("stp x29, x30, [sp, #(28*8)]"); 来保存LR 寄存器, 对于 common_closure_bridge_handler 来说应该是错误的。

因为这段函数是通过 两次 BLR X17 跳转的, 他保存的是他的上一层跳转函数的, 而不是原始函数的 LR

在 common_closure_bridge_handler 中使用 ctx->lr 也不是 closure_bridge_template 保存的 X30, 是取的 ctx+0x108的位置(x0 是ctx+0x18 是对的),结果很奇怪