asLody / whale

Hook Framework for Android/IOS/Linux/MacOS
Apache License 2.0
1.56k stars 338 forks source link

handle AOSP 10 Runtime changes #53

Open c3ph3us opened 4 years ago

c3ph3us commented 4 years ago

support android 10 changes:

In Android 10, the ART build system creates the Runtime module in two variants: release and debug (contains additional diagnostic and debugging tools). The release version is installed on user builds and the debug version is installed on userdebug and eng builds. When a device boots, apexd mounts the Runtime module under /apex/com.android.runtime.

Native libraries Android 10 refactors native libraries that support the Managed Core Library. Several dynamically linked libraries (for example, libcrypto, libexpat, and zlib) that were previously shared with other parts of the platform are now duplicated so that the Runtime module has its own copies loaded into the runtime linker namespace. Dynamically linked native libraries provided by the Runtime module are in /apex/com.android.runtime/{lib,lib64}.

Android 10 moves the libnativebridge library to the Runtime module as this library is tightly coupled with libnativeloader and the Bionic C libraries that are part of the Runtime module.

refs:

https://source.android.com/devices/architecture/modular-system/runtime https://source.android.com/devices/architecture/vndk/linker-namespace

art_runtime.cc:58 refs libart.so

art_runtime.h:18

static constexpr const char kAndroidLibDir = "/system/lib64/"; static constexpr const char kLibNativeBridgePath = "/system/lib64/libnativebridge.so"; static constexpr const char kLibArtPath = "/system/lib64/libart.so"; static constexpr const char kLibAocPath = "/system/lib64/libaoc.so"; static constexpr const char *kLibHoudiniArtPath = "/system/lib64/arm64/libart.so";

static constexpr const char kAndroidLibDir = "/system/lib/"; static constexpr const char kLibArtPath = "/system/lib/libart.so"; static constexpr const char kLibAocPath = "/system/lib/libaoc.so"; static constexpr const char kLibHoudiniArtPath = "/system/lib/arm/libart.so";

c3ph3us commented 4 years ago

related

https://github.com/asLody/whale/issues/50 https://github.com/asLody/whale/issues/48 https://github.com/asLody/whale/issues/15

c3ph3us commented 4 years ago

proposed changes :

https://github.com/WaterlooBridge/EdXposed/commit/afce9d994b9d09a0c7039ef3b0a465dc7d7f5bc6#diff-534fc7ad6e200111ceb0e7b2c6348f7f

https://github.com/WaterlooBridge/EdXposed/commit/afce9d994b9d09a0c7039ef3b0a465dc7d7f5bc6#diff-459a15778cb5024a1b05e7f8606d041c

https://github.com/WaterlooBridge/EdXposed/commit/afce9d994b9d09a0c7039ef3b0a465dc7d7f5bc6#diff-0cd62b110d1d1345705f1b9f2fbd6dad

https://github.com/WaterlooBridge/EdXposed/commit/afce9d994b9d09a0c7039ef3b0a465dc7d7f5bc6#diff-75bb3ce798b5fb791b47382fc7ea3245

lyqaiym commented 4 years ago

add "/apex/com.android.runtime/lib/libart.so" if (apilevel >= ANDROID_Q) expected_access_flags |= kAccPublicApi; but crash

2020-05-17 19:40:55.528 30782-30782/com.example.looper A/libc: Fatal signal 7 (SIGBUS), code 1 (BUS_ADRALN), fault addr 0xca05406c in tid 30782 (.example.looper), pid 30782 (.example.looper) 2020-05-17 19:40:55.578 31079-31079/? A/DEBUG: 2020-05-17 19:40:55.578 31079-31079/? A/DEBUG: Build fingerprint: 'samsung/d2xqzc/d2xq:10/QP1A.190711.020/N9760ZCU1BTA1:user/release-keys' 2020-05-17 19:40:55.578 31079-31079/? A/DEBUG: Revision: '16' 2020-05-17 19:40:55.578 31079-31079/? A/DEBUG: ABI: 'arm' 2020-05-17 19:40:55.578 31079-31079/? A/DEBUG: Timestamp: 2020-05-17 19:40:55+0800 2020-05-17 19:40:55.578 31079-31079/? A/DEBUG: pid: 30782, tid: 30782, name: .example.looper >>> com.example.looper <<< 2020-05-17 19:40:55.578 31079-31079/? A/DEBUG: uid: 10434 2020-05-17 19:40:55.578 31079-31079/? A/DEBUG: signal 7 (SIGBUS), code 1 (BUS_ADRALN), fault addr 0xca05406c 2020-05-17 19:40:55.578 31079-31079/? A/DEBUG: r0 eede6821 r1 ca05406c r2 ffb55920 r3 ffb55924 2020-05-17 19:40:55.578 31079-31079/? A/DEBUG: r4 c25c7794 r5 f17efe00 r6 c3a14871 r7 ffb55808 2020-05-17 19:40:55.578 31079-31079/? A/DEBUG: r8 00000000 r9 f3a73e00 r10 ffb55930 r11 f3a73e00 2020-05-17 19:40:55.578 31079-31079/? A/DEBUG: ip c25c8a04 sp ffb55750 lr c23369fb pc eede6820 2020-05-17 19:40:55.579 31079-31079/? A/DEBUG: backtrace: 2020-05-17 19:40:55.579 31079-31079/? A/DEBUG: #00 pc 00208820 /apex/com.android.runtime/lib/libart.so (_ZN3art11interpreter10DoFieldPutILNS_13FindFieldTypeE37ELNS_9Primitive4TypeE0ELb1ELb1EEEbPNS_6ThreadERKNS_11ShadowFrameEPKNS_11InstructionEt+1272) (BuildId: 84d977a6273fa7d72047ec0f95daaf95)