diff --git a/.github/workflows/core.yml b/.github/workflows/core.yml index d3b6ac7953e..e827084d1ed 100644 --- a/.github/workflows/core.yml +++ b/.github/workflows/core.yml @@ -62,9 +62,6 @@ jobs: - name: Setup Gradle uses: gradle/actions/setup-gradle@v4 - - name: Grant Execute Permission for gradlew - run: chmod +x gradlew - - name: Setup ninja uses: seanmiddleditch/gha-setup-ninja@v5 with: @@ -75,14 +72,6 @@ jobs: with: version: latest - - name: Setup ccache - uses: hendrikmuhs/ccache-action@v1.2 - with: - max-size: 2G - key: ${{ runner.os }} - restore-keys: ${{ runner.os }} - save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} - - name: Remove Android's cmake shell: bash run: rm -rf $ANDROID_HOME/cmake diff --git a/core/src/main/jni/src/native_api.h b/core/src/main/jni/src/native_api.h index 4c6c4388eb4..1fd2d1f20e6 100644 --- a/core/src/main/jni/src/native_api.h +++ b/core/src/main/jni/src/native_api.h @@ -25,11 +25,12 @@ #ifndef LSPOSED_NATIVE_API_H #define LSPOSED_NATIVE_API_H -#include #include -#include #include +#include +#include + #include "config.h" #include "utils/hook_helper.hpp" @@ -48,33 +49,36 @@ typedef struct { typedef NativeOnModuleLoaded (*NativeInit)(const NativeAPIEntries *entries); namespace lspd { - bool InstallNativeAPI(const lsplant::HookHandler& handler); +bool InstallNativeAPI(const lsplant::HookHandler &handler); - void RegisterNativeLib(const std::string &library_name); +void RegisterNativeLib(const std::string &library_name); - inline int HookInline(void *original, void *replace, void **backup) { - if constexpr (isDebug) { - Dl_info info; - if (dladdr(original, &info)) +inline int HookInline(void *original, void *replace, void **backup) { + Dl_info info; + if constexpr (isDebug) { + if (dladdr(original, &info)) LOGD("Dobby hooking {} ({}) from {} ({})", info.dli_sname ? info.dli_sname : "(unknown symbol)", - info.dli_saddr ? info.dli_saddr : original, + info.dli_saddr ? info.dli_saddr : original, info.dli_fname ? info.dli_fname : "(unknown file)", info.dli_fbase); - } - return DobbyHook(original, reinterpret_cast(replace), reinterpret_cast(backup)); } + if (!info.dli_sname) return 1; + return DobbyHook(original, reinterpret_cast(replace), + reinterpret_cast(backup)); +} - inline int UnhookInline(void *original) { - if constexpr (isDebug) { - Dl_info info; - if (dladdr(original, &info)) +inline int UnhookInline(void *original) { + Dl_info info; + if constexpr (isDebug) { + if (dladdr(original, &info)) LOGD("Dobby unhooking {} ({}) from {} ({})", info.dli_sname ? info.dli_sname : "(unknown symbol)", - info.dli_saddr ? info.dli_saddr : original, + info.dli_saddr ? info.dli_saddr : original, info.dli_fname ? info.dli_fname : "(unknown file)", info.dli_fbase); - } - return DobbyDestroy(original); } + if (!info.dli_sname) return 1; + return DobbyDestroy(original); } +} // namespace lspd -#endif //LSPOSED_NATIVE_API_H +#endif // LSPOSED_NATIVE_API_H diff --git a/dex2oat/src/main/cpp/dex2oat.c b/dex2oat/src/main/cpp/dex2oat.c index 1e120623e96..20c2d7fd772 100644 --- a/dex2oat/src/main/cpp/dex2oat.c +++ b/dex2oat/src/main/cpp/dex2oat.c @@ -23,6 +23,7 @@ #include #include +#include #include #include #include @@ -31,9 +32,9 @@ #include "logging.h" #if defined(__LP64__) -# define LP_SELECT(lp32, lp64) lp64 +#define LP_SELECT(lp32, lp64) lp64 #else -# define LP_SELECT(lp32, lp64) lp32 +#define LP_SELECT(lp32, lp64) lp32 #endif #define ID_VEC(is64, is_debug) (((is64) << 1) | (is_debug)) @@ -50,23 +51,17 @@ static ssize_t xrecvmsg(int sockfd, struct msghdr *msg, int flags) { static void *recv_fds(int sockfd, char *cmsgbuf, size_t bufsz, int cnt) { struct iovec iov = { - .iov_base = &cnt, - .iov_len = sizeof(cnt), + .iov_base = &cnt, + .iov_len = sizeof(cnt), }; struct msghdr msg = { - .msg_iov = &iov, - .msg_iovlen = 1, - .msg_control = cmsgbuf, - .msg_controllen = bufsz - }; + .msg_iov = &iov, .msg_iovlen = 1, .msg_control = cmsgbuf, .msg_controllen = bufsz}; xrecvmsg(sockfd, &msg, MSG_WAITALL); struct cmsghdr *cmsg = CMSG_FIRSTHDR(&msg); - if (msg.msg_controllen != bufsz || - cmsg == NULL || - cmsg->cmsg_len != CMSG_LEN(sizeof(int) * cnt) || - cmsg->cmsg_level != SOL_SOCKET || + if (msg.msg_controllen != bufsz || cmsg == NULL || + cmsg->cmsg_len != CMSG_LEN(sizeof(int) * cnt) || cmsg->cmsg_level != SOL_SOCKET || cmsg->cmsg_type != SCM_RIGHTS) { return NULL; } @@ -78,8 +73,7 @@ static int recv_fd(int sockfd) { char cmsgbuf[CMSG_SPACE(sizeof(int))]; void *data = recv_fds(sockfd, cmsgbuf, sizeof(cmsgbuf), 1); - if (data == NULL) - return -1; + if (data == NULL) return -1; int result; memcpy(&result, data, sizeof(int)); @@ -88,8 +82,7 @@ static int recv_fd(int sockfd) { static int read_int(int fd) { int val; - if (read(fd, &val, sizeof(val)) != sizeof(val)) - return -1; + if (read(fd, &val, sizeof(val)) != sizeof(val)) return -1; return val; } @@ -105,7 +98,7 @@ int main(int argc, char **argv) { strlcpy(sock.sun_path + 1, kSockName, sizeof(sock.sun_path) - 1); int sock_fd = socket(AF_UNIX, SOCK_STREAM, 0); size_t len = sizeof(sa_family_t) + strlen(sock.sun_path + 1) + 1; - if (connect(sock_fd, (struct sockaddr *) &sock, len)) { + if (connect(sock_fd, (struct sockaddr *)&sock, len)) { PLOGE("failed to connect to %s", sock.sun_path + 1); return 1; } @@ -119,7 +112,13 @@ int main(int argc, char **argv) { for (int i = 0; i < argc; i++) new_argv[i] = argv[i]; new_argv[argc] = "--inline-max-code-units=0"; new_argv[argc + 1] = NULL; - fexecve(stock_fd, (char **) new_argv, environ); + + char const *libenv = + "LD_LIBRARY_PATH=/system/lib64:/system/lib:" + "/apex/com.android.art/lib64:/apex/com.android.art/lib:" + "/apex/com.android.os.statsd/lib64:/apex/com.android.os.statsd/lib"; + putenv((char *)libenv); + fexecve(stock_fd, (char **)new_argv, environ); PLOGE("fexecve failed"); return 2; } diff --git a/external/lsplant b/external/lsplant index d73aa7f9742..7a0cdb9877c 160000 --- a/external/lsplant +++ b/external/lsplant @@ -1 +1 @@ -Subproject commit d73aa7f9742b3c13084bb719962cfcd9358dd0f3 +Subproject commit 7a0cdb9877cd8c35fba636e3da40a0b444754629 diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 05c492804b0..108d311e84e 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,7 +1,7 @@ [versions] agp = "8.6.0" kotlin = "2.0.20" -nav = "2.7.7" +nav = "2.8.0" appcenter = "5.0.4" libxposed = "100" glide = "4.16.0" @@ -35,12 +35,12 @@ rikkax-recyclerview = { module = "dev.rikka.rikkax.recyclerview:recyclerview-ktx rikkax-widget-borderview = { module = "dev.rikka.rikkax.widget:borderview", version = "1.1.0" } rikkax-widget-mainswitchbar = { module = "dev.rikka.rikkax.widget:mainswitchbar", version = "1.0.2" } -androidx-activity = { module = "androidx.activity:activity", version = "1.9.1" } +androidx-activity = { module = "androidx.activity:activity", version = "1.9.2" } androidx-annotation = { module = "androidx.annotation:annotation", version = "1.8.2" } androidx-browser = { module = "androidx.browser:browser", version = "1.8.0" } androidx-constraintlayout = { module = "androidx.constraintlayout:constraintlayout", version = "2.1.4" } androidx-core = { module = "androidx.core:core", version = "1.13.1" } -androidx-fragment = { module = "androidx.fragment:fragment", version = "1.8.2" } +androidx-fragment = { module = "androidx.fragment:fragment", version = "1.8.3" } androidx-navigation-fragment = { group = "androidx.navigation", name = "navigation-fragment", version.ref = "nav" } androidx-navigation-ui = { group = "androidx.navigation", name = "navigation-ui", version.ref = "nav" } androidx-preference = { module = "androidx.preference:preference", version = "1.2.1" } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 9355b415575..0aaefbcaf0f 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.1-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/magisk-loader/src/main/jni/src/magisk_loader.cpp b/magisk-loader/src/main/jni/src/magisk_loader.cpp index 13c1c221e00..74466d380b6 100644 --- a/magisk-loader/src/main/jni/src/magisk_loader.cpp +++ b/magisk-loader/src/main/jni/src/magisk_loader.cpp @@ -119,13 +119,13 @@ void MagiskLoader::OnNativeForkSystemServerPost(JNIEnv *env) { .inline_hooker = [](auto t, auto r) { void *bk = nullptr; - return HookPLT(t, r, &bk) == 0 ? bk : nullptr; + return HookInline(t, r, &bk) == 0 ? bk : nullptr; }, - .inline_unhooker = [](auto t) { return UnhookPLT(t) == 0; }, + .inline_unhooker = [](auto t) { return UnhookInline(t) == 0; }, .art_symbol_resolver = [](auto symbol) { return GetArt()->getSymbAddress(symbol); }, .art_symbol_prefix_resolver = [](auto symbol) { return GetArt()->getSymbPrefixFirstAddress(symbol); }, - .is_plt_hook = true}; + }; InitArtHooker(env, initInfo); InitHooks(env); SetupEntryClass(env); @@ -191,13 +191,13 @@ void MagiskLoader::OnNativeForkAndSpecializePost(JNIEnv *env, jstring nice_name, .inline_hooker = [](auto t, auto r) { void *bk = nullptr; - return HookPLT(t, r, &bk) == 0 ? bk : nullptr; + return HookInline(t, r, &bk) == 0 ? bk : nullptr; }, - .inline_unhooker = [](auto t) { return UnhookPLT(t) == 0; }, + .inline_unhooker = [](auto t) { return UnhookInline(t) == 0; }, .art_symbol_resolver = [](auto symbol) { return GetArt()->getSymbAddress(symbol); }, .art_symbol_prefix_resolver = [](auto symbol) { return GetArt()->getSymbPrefixFirstAddress(symbol); }, - .is_plt_hook = true}; + }; auto [dex_fd, size] = instance->RequestLSPDex(env, binder); auto obfs_map = instance->RequestObfuscationMap(env, binder); ConfigBridge::GetInstance()->obfuscation_map(std::move(obfs_map));