LSPosed Hooking Issue Analysis

Reproduction Steps/复现步骤

  1. Version Comparison: Compare the leaked version of LSPosed 1.9.2.IT (7388) with the stable version LSPosed 1.10.2.7182. The former version works correctly, while the latter fails to function as expected.
  2. Code Source: All code is derived from the LSPosed wiki Native-Hook documentation.
  3. Details: In the hook module, the function native_init is never triggered.
extern "C" [[gnu::visibility("default")]] [[gnu::used]] NativeOnModuleLoaded native_init(const NativeAPIEntries *entries) {
    char* aaa = ("JNI_OnLoad, 2222");
    LOGD("%s", aaa);
    hook_func = entries->hook_func;
    unhook_fun = entries->unhook_func;
    // system hooks
    //hook_func((void*) fopen, (void*) fake_fopen, (void**) &backup_fopen);
    return on_library_loaded;
}

If switched to the leaked version of LSPosed, the issue resolves, and native_init functions correctly.

Expected Behavior/预期行为

The function native_init should be triggered as intended.

Actual Behavior/实际行为

The function native_init is never triggered.

Xposed Module List/Xposed 模块列表

Zygisk Next 1.2.9

Root Implementation/Root 方案

KSU (KernelSU)

System Module List/系统模块列表

Zygisk Next 1.2.9
MoveCertificates

LSPosed Version/LSPosed 版本

1.10.2 7182

Android Version/Android 版本

Android 13

Version Requirement/版本要求

Logs/日志

Simple logs indicating the issue.

Analysis and Recommendations

The discrepancy between the leaked and stable versions of LSPosed suggests a compatibility issue with the hooking mechanism in the newer version. The native_init function not being triggered indicates a failure in the initialization process, possibly due to changes in the internal API or hooking implementation. To resolve this, consider reverting to the leaked version as a temporary workaround or investigate the specific changes introduced in version 1.10.2 that might be causing the conflict. Additionally, ensure that all dependencies and system modules are up-to-date to avoid any potential conflicts.