Skip to content

Android 12 hook 后 cfi_check 崩溃显著增加 #98

Open
@onvejon

Description

@onvejon

bytehook Version

1.0.10

Android OS Version

12

Android ABIs

armeabi-v7a

Device Manufacturers and Models

定制安卓设备

Describe the Bug

image
目前遇到的情况是,启用hook后,极易出现 cfi_check 崩溃,关闭后则几乎不会出现 cfi_check 崩溃。希望获得大佬的指定和帮助。

hook代码如下,对libc的socket接口进行了hook。其他一切配置都是按照例子里面的调用方法。
有一点疑惑的点:调用hook的时机不是在 Application.onCreate. 而是在App启动后的一段时间才hook的,和例子有些不同,不知道这样调用会有什么影响。

static bool allow_filter(const char *caller_path_name, void *arg) {
    (void)arg;

    if (NULL != strstr(caller_path_name, "libc.so")) return false;
    if (NULL != strstr(caller_path_name, "libbase.so")) return false;
    if (NULL != strstr(caller_path_name, "liblog.so")) return false;
    if (NULL != strstr(caller_path_name, "libunwindstack.so")) return false;
    if (NULL != strstr(caller_path_name, "libutils.so")) return false;
    // ......

    return true;
}

if (!sock_sendto_stub) {
        sock_sendto_stub = bytehook_hook_partial(allow_filter, NULL, "libc.so", "sendto" , sock_sendto_proxy_auto, sock_sendto_hooked_callback, NULL);
    }
    if (!sock_recvfrom_stub) {
        sock_recvfrom_stub = bytehook_hook_partial(allow_filter, NULL, "libc.so", "recvfrom" , sock_recvfrom_proxy_auto, sock_recvfrom_hooked_callback, NULL);
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions