fix(defender): ObjC 方法基线改用构建期签名清单,修复误报 110 导致的延迟闪退
- 构建期生成随包签名的 IGMethods.bin(仅主程序),运行时按镜像 UUID、 入口偏移与函数边界内指令摘要校验;导出审计复核清单与最终镜像一致 - 系统函数、调度与解包保护的代码前缀按 LC_FUNCTION_STARTS 限定在函数边界内 - 边界内识别 B / LDR+BR / ADRP+ADD+BR / MOVK+BR 蹦床并确认目标归属,避免系统尾调用误报 - 登记前 IMP 已落入匿名内存判为改写;清单读取改走 IG_dispatch_open - 函数边界长度按入口缓存;镜像未重新链接时复用基线;Debug 附加调试器时不按入口摘要判定改写 - 补充宿主测试;删除已过时的 README 与 docs 历史文档,保留 THIRD_PARTY_NOTICES
This commit is contained in:
@@ -76,6 +76,7 @@ static pthread_once_t once = PTHREAD_ONCE_INIT;
|
||||
static _Thread_local int resolving;
|
||||
static _Atomic(uintptr_t) targets[IG_ARCHIVE_FUNCTION_COUNT];
|
||||
static uintptr_t expected[IG_ARCHIVE_FUNCTION_COUNT];
|
||||
static size_t prefix_lengths[IG_ARCHIVE_FUNCTION_COUNT];
|
||||
static unsigned char prefixes[IG_ARCHIVE_FUNCTION_COUNT][16];
|
||||
static IGStatus initial[IG_ARCHIVE_FUNCTION_COUNT];
|
||||
static int initialReason[IG_ARCHIVE_FUNCTION_COUNT];
|
||||
@@ -229,7 +230,8 @@ static void initialize(void) {
|
||||
IGResolveResult result = ig_resolve_verified(NULL, names[i], name_lengths[i], ig_response_capture, &initialReason[i]);
|
||||
initial[i] = result.status;
|
||||
if (result.status != IG_CLEAR || !result.address) continue;
|
||||
if (!read_bytes((uintptr_t)IG_ARCHIVE_STRIP(result.address), prefixes[i], 16)) {
|
||||
prefix_lengths[i] = ig_function_prefix_size(result.address, sizeof(prefixes[i]));
|
||||
if (!prefix_lengths[i] || !read_bytes((uintptr_t)IG_ARCHIVE_STRIP(result.address), prefixes[i], prefix_lengths[i])) {
|
||||
initial[i] = IG_UNAVAILABLE;
|
||||
continue;
|
||||
}
|
||||
@@ -258,8 +260,8 @@ static IGStatus validate(unsigned index, uintptr_t *address, int *reason) {
|
||||
uintptr_t current = atomic_load_explicit(&targets[index], memory_order_acquire);
|
||||
if (!current || current != expected[index]) return IG_DETECTED;
|
||||
unsigned char bytes[16];
|
||||
if (!read_bytes((uintptr_t)IG_ARCHIVE_STRIP((const void *)current), bytes, 16)) return IG_UNAVAILABLE;
|
||||
if (ig_memcmp(bytes, prefixes[index], 16)) return IG_DETECTED;
|
||||
if (!read_bytes((uintptr_t)IG_ARCHIVE_STRIP((const void *)current), bytes, prefix_lengths[index])) return IG_UNAVAILABLE;
|
||||
if (ig_memcmp(bytes, prefixes[index], prefix_lengths[index])) return IG_DETECTED;
|
||||
*reason = IG_REASON_VERIFICATION_UNAVAILABLE;
|
||||
IGStatus status = ig_verify_function((void *)current, IG_DIAG_STR("archive-target"), ig_response_capture, reason);
|
||||
if (status != IG_CLEAR) return status;
|
||||
|
||||
Reference in New Issue
Block a user