Android 12 hook 后 cfi_check 崩溃显著增加

Open
#98 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
android, c

Research direction

Review the bytehook_hook_partial calls for libc sendto and recvfrom, the allow_filter function, and the difference between delayed hooking and the Application.onCreate timing used by the example. Reproduce on Android 12 with armeabi-v7a if possible; done means identifying the conditions associated with the increased cfi_check crashes and documenting a confirmed cause or a minimal reproduction.

Written by the indexing model from the issue text.

Description

bug
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);
    }
Dominant language
C
Stars
2.6k
Forks
407
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from bytedance/bhook

All issues in bytedance/bhook

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.