diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 61afb401..c7869ceb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,7 +30,7 @@ jobs: java-version: "17" - name: Setup Gradle - uses: gradle/actions/setup-gradle@v3 + uses: gradle/actions/setup-gradle@v4.2.1 with: gradle-home-cache-cleanup: true diff --git a/README.md b/README.md index e28f4d86..3fbf1e86 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # ReZygisk -[中文](https://github.com/PerformanC/ReZygisk/blob/main/README_CN.md) +[简体中文](/READMEs/README_zh-CN.md)|[繁體中文](/READMEs/README_zh-TW.md) ReZygisk is a fork of Zygisk Next, a standalone implementation of Zygisk, providing Zygisk API support for KernelSU, Magisk (besides built-in), and APatch (Work In Progress). @@ -25,27 +25,8 @@ The Zygisk Next developers are famous and trusted in the Android community, howe | Tool | Description | |-----------------|----------------------------------------| -| `rustc` | The Rust compiler | | `Android NDK` | Native Development Kit for Android | -### Rust Dependencies - -| Dependency | Description | -|------------------|---------------------------------------------------------------| -| `android_logger` | Logger for Android platform | -| `anyhow` | Error handling library | -| `bitflags` | Macro to generate structures for bitwise operations | -| `const_format` | Compile-time string formatting | -| `futures` | Abstractions for asynchronous programming | -| `konst` | Compile-time constant evaluation | -| `lazy_static` | Macro for declaring lazily evaluated static variables | -| `libc` | FFI bindings to native C libraries | -| `log` | Logging facade | -| `memfd` | Memory file descriptor utilities | -| `num_enum` | Derive macros to convert between numbers and enums | -| `passfd` | Passing file descriptors over Unix sockets | -| `proc-maps` | Parse and analyze process memory maps | - ### C++ Dependencies | Dependency | Description | @@ -62,7 +43,7 @@ There are currently no available stable releases. (Coming Soon) ## Translation -As of now, we don't have integration with another platform for translations but you may contribute to the [add/webui](https://github.com/PerformanC/ReZygisk/tree/add/webui) branch. Please don't forget to include your GitHub profile in [TRANSLATOR.md](https://github.com/PerformanC/ReZygisk/blob/add/webui/TRANSLATOR.md) so that people can see your contribution. +As of now, we don't have integration with another platform for translations but you may contribute to the [add/new-webui](https://github.com/PerformanC/ReZygisk/tree/add/new-webui) branch. Please don't forget to include your GitHub profile in [TRANSLATOR.md](https://github.com/PerformanC/ReZygisk/blob/add/new-webui/TRANSLATOR.md) so that people can see your contribution. ## Support For any question related to ReZygisk or other PerformanC projects, feel free to join any of the following channels below: diff --git a/READMEs/README_ja-JP.md b/READMEs/README_ja-JP.md new file mode 100644 index 00000000..80633b82 --- /dev/null +++ b/READMEs/README_ja-JP.md @@ -0,0 +1,73 @@ +# ReZygisk + +[English](https://github.com/PerformanC/ReZygisk/blob/main/README.md)|[简体中文](/READMEs/README_zh-CN.md)|[繁體中文](/READMEs/README_zh-TW.md) + +ReZygiskはkernelSU、Magisk、APatchにZygiskのAPIサポートを提供するスタンドアローンZygiskであるZygisk Nextのフォークです。 + +ReZygiskは更に高速かつ効率的なZygisk APIとより寛容なライセンスを、コードベースをC(もともとはC++とRustでした)でアップデート/書き直すことで実現することを目標としています。 + +> [!NOTE] +> このモジュール/フォークはWIP(Work in Progress、すべての作業が進行中であることを意味します): ReleasesタブのZipのみを使用するようにしてください。 +> +> GitHub [Actions](https://github.com/PerformanC/ReZygisk/actions) よりZipをダウンロードして使用することも可能ですが、デバイスがブートループなどの不具合が起きる可能性があります。ユーザー自身の裁量にて使用してください。 + +## ReZygiskを使う理由 + +Zygisk Nextの最新リリースはクローズドソースであり、コードはプロジェクトの開発者のみアクセスできるものです。これはコミュニティがコードに貢献することを妨げるだけではなく、コード監査をも難しくしています。これはZygisk Nextがルート権限で作動するアプリであるため、セキュリティ上深刻な問題です。 + +Zygisk Nextの開発者はAndroid Communityにて有名かつ信用されています。が、これはコード自体が悪意の無いこと/脆弱でないことを証明するものではありません。 + +我々(PerformanC)はZygisk Nextの開発者らがコードをクローズドに保つ重要な理由があることは承知していますが、我々はオープンソース/コミュニティドリブンにすることが重要だと考えています。 + +## メリット + +- オープンソース、Free to Use、FOSS (永続的) + +## 依存関係 + +| ツール | 説明 | +|-----------------|----------------------------------------| +| `Android NDK` | Androidのネイティブ開発環境キット | + +### C++ 依存関係 + +| 依存 | 説明 | +|------------|-------------------------------| +| `lsplt` | シンプルなAndroidのPLTフック | + +## 使い方 + +ただいま調理中です、しばらくお待ち下さい!(できるだけ早くお届けします) + +## インストール + +現状、ステーブルリリースはありません。(できるだけ早くお届けします) + +## 翻訳 + +現状では、翻訳を他のプラットフォーム上で展開することはしていません。 + +が、[add/new-webui](https://github.com/PerformanC/ReZygisk/tree/add/new-webui) ブランチにて翻訳作業に参加していただくことができます。 + +他の開発者さんたちがあなたの貢献を確認できるように、 [TRANSLATOR.md](https://github.com/PerformanC/ReZygisk/blob/add/new-webui/TRANSLATOR.md) にあなたのプロフィールを追加することを忘れないでください! + +## サポート +For any question related to ReZygisk or other PerformanC projects, feel free to join any of the following channels below: +ReZygisk/他のPerformanCのプロジェクトに対する質問がある場合は、以下のどれかに参加してください! + +- Discord チャンネル: [PerformanC](https://discord.gg/uPveNfTuCJ) +- ReZygisk Telegram チャンネル: [@rezygiskchat](https://t.me/rezygiskchat) +- PerformanC Telegram チャンネル: [@performancorg](https://t.me/performancorg) + +## 貢献 + +貢献をしたい場合、PerformanCの[Contribution Guidelines](https://github.com/PerformanC/contributing)に従うことが必要になります。 + +セキュリティーポリシー、行動規範、シンタックススタンダードを採用してください。 + +## ライセンス + +ReZygiskは基本的にDr-TSNGによるGPLライセンス下にてライセンスされています。 + +ただし、書き直しされたコードに関してはPerformanCによるAGPL3.0ライセンスにてライセンスされています。 +詳細については [Open Source Initiative](https://opensource.org/licenses/AGPL-3.0) を参照してください。 diff --git a/README_CN.md b/READMEs/README_zh-CN.md similarity index 55% rename from README_CN.md rename to READMEs/README_zh-CN.md index 7d03c7f5..da3af96e 100644 --- a/README_CN.md +++ b/READMEs/README_zh-CN.md @@ -11,9 +11,9 @@ ReZygisk 是 Zygisk 的另一个独立实现,从 Zygisk Next 分叉而来, > > 您可以从 [Actions](https://github.com/PerformanC/ReZygisk/actions) 页面下载自动构建包,但要注意自负风险。使用不稳定的版本时,设备可能会陷入启动循环(Bootloop)。 -## 为什么要ReZygisk? +## 为什么要选择 ReZygisk? -最新版本的 Zygisk Next 并不开源,仅其核心开发者有权查阅全部源代码。这不仅阻止了其他开发者贡献代码,还阻止了他们对项目代码进行审计。Zygisk Next 是一个以超级用户(root)权限运行的模块,可以访问整个系统,闭源后存在重大安全隐患。 +最新版本的 Zygisk Next 并不开源,仅其核心开发者有权查阅全部源代码。这不仅阻止了其他开发者贡献代码,还阻止了他人对项目代码进行审计。Zygisk Next 是一个以超级用户(root)权限运行的模块,可以访问整个系统,闭源后存在重大安全隐患。 Zygisk Next 的开发者们在Android社区享有盛誉,备受信任。但这并不意味着他们的项目就一定没有任何恶意代码和漏洞。我们(PerformanC)理解他们出于某些原因不愿保持开源,但我们坚信,开源是更好的选择。 @@ -23,34 +23,15 @@ Zygisk Next 的开发者们在Android社区享有盛誉,备受信任。但这 ## 依赖 -| 工具 | 简介 | +| 工具 | 简介 | |---------------|------------------------------------| -| `rustc` | Rust 编译器 | -| `Android NDK` | Android 本地开发工具包 | - -### Rust 依赖 - -| 依赖 | 简介 | -|------------------|-------------------------------------------------------| -| `android_logger` | Android 日志记录工具 | -| `anyhow` | 错误处理库 | -| `bitflags` | 用于生成位操作结构的宏 | -| `const_format` | 编译时字符串格式化 | -| `futures` | 异步编程的抽象实现 | -| `konst` | 编译时常量比较 | -| `lazy_static` | 用于声明静态延迟比较变量的宏 | -| `libc` | 对各平台系统C语言库的原始 FFI 绑定 | -| `log` | 日志外观框架 | -| `memfd` | 内存文件描述符实用程序 | -| `num_enum` | 在数字类型和枚举类型之间进行转换的衍生宏 | -| `passfd` | 通过Unix套接字传递文件描述符 | -| `proc-maps` | 解析和分析进程内存映射 | +| `Android NDK` | Android 本地开发工具包 | ### C++ 依赖 -| 依赖 | 简介 | +| 依赖 | 简介 | |---------|-----------------------------| -| `lsplt` | Android 程序链接表钩子 | +| `lsplt` | Android 程序链接表钩子 | ## 用法 @@ -62,9 +43,9 @@ Zygisk Next 的开发者们在Android社区享有盛誉,备受信任。但这 ## 翻译 -您可以向 [add/webui](https://github.com/PerformanC/ReZygisk/tree/add/webui) 分支贡献翻译。 +您可以向 [add/new-webui](https://github.com/PerformanC/ReZygisk/tree/add/new-webui) 分支贡献翻译。 -请不要忘记在 [TRANSLATOR.md](https://github.com/PerformanC/ReZygisk/blob/add/webui/TRANSLATOR.md) 中添加您的 GitHub 账号信息,以便人们看到您的贡献。 +请不要忘记在 [TRANSLATOR.md](https://github.com/PerformanC/ReZygisk/blob/add/new-webui/TRANSLATOR.md) 中添加您的 GitHub 账号信息,以便人们看到您的贡献。 ## 支持 diff --git a/READMEs/README_zh-TW.md b/READMEs/README_zh-TW.md new file mode 100644 index 00000000..5762eadf --- /dev/null +++ b/READMEs/README_zh-TW.md @@ -0,0 +1,62 @@ +# ReZygisk +> 繁體中文(README_zh-TW.md)是根據[英文版自述檔案(README.md)](https://github.com/PerformanC/ReZygisk/blob/main/README.md)翻譯,僅供參考以便理解英文內容,翻譯可能滯後。 + +ReZygisk 是 Zygisk Next 的一個分支,這是一個獨立實現的 Zygisk,為 KernelSU、Magisk(除了內建支援外)和 APatch(開發中)提供 Zygisk API 支援。 + +此專案致力於用 C 語言重寫原有的 C++ 和 Rust 代碼,藉此以更現代且高效的方式實現 Zygisk API,並採用更寬鬆的授權條款。 + +> [!NOTE] +> 此模組/分支仍在開發中(WIP);請僅安裝正式版本的壓縮包。 +> +> 雖然你可以從 [Actions](https://github.com/PerformanC/ReZygisk/actions) 頁面安裝 .zip 檔,但若因此導致裝置進入開機循環(Bootloop),後果須自行承擔。 + +## 為什麼選擇ReZygisk? + +最新版本的 Zygisk Next 已轉為閉源,只有核心開發者能查閱完整的原始碼。這不僅限制了其他開發者的貢獻,也無法進行代碼審計。由於 Zygisk Next 是一個以超級使用者(root)權限運行的模組,能夠存取整個系統,若閉源將帶來重大的安全風險。 + +雖然 Zygisk Next 的開發者在 Android 社群中享有盛譽,並且備受信任,但這並不代表他們的專案就完全沒有任何惡意程式碼或漏洞。我們(PerformanC)理解他們因某些原因選擇保持閉源,但我們堅信開源才是更好的選擇。 + +## 優勢 + +- 永遠是自由及開放原始碼軟體(FOSS) + +## 依賴項 + +| 工具 | 說明 | +|-----------------|---------------------------------------| +| `Android NDK` | Android 原生開發工具包 | + +### C++ 依賴項 + +| 依賴 | 說明 | +|----------|----------------------------------------------| +| `lsplt` | Android 的簡單 PLT(程式連結表) 勾取 | + +## 用法 + +我們目前正在開發中。(敬請期待) + +## 安裝 + +目前沒有穩定版本可供下載。(敬請期待) + +## 翻譯 + +目前我們尚未與其他平台整合進行翻譯,但您可以為 [add/new-webui](https://github.com/PerformanC/ReZygisk/tree/add/new-webui)分支做出貢獻。請別忘了在 [TRANSLATOR.md](https://github.com/PerformanC/ReZygisk/blob/add/new-webui/TRANSLATOR.md) 中包含您的 GitHub 個人檔案,讓大家能夠看到您的貢獻。 + +## 支援 +如有關於 ReZygisk 或其他 PerformanC 專案的任何問題,歡迎加入以下任一頻道: + +- Discord 頻道: [PerformanC](https://discord.gg/uPveNfTuCJ) +- ReZygisk Telegram 頻道: [@rezygiskchat](https://t.me/rezygiskchat) +- PerformanC Telegram 頻道: [@performancorg](https://t.me/performancorg) + +## 貢獻 + +要為 ReZygisk 貢獻,必須遵循 PerformanC 的[貢獻指南](https://github.com/PerformanC/contributing),並遵守其安全政策、行為準則以及語法標準。 + +## 授權條款 + +在 ReZygisk 專案中,舊的 Zygisk Next 部分採用了 GPL 授權,而由 PerformanC 組織重寫的程式碼則採用 AGPL 3.0 授權。 + +您可以在[開放原始碼倡議(Open Source Initiative)](https://opensource.org/licenses/AGPL-3.0)上閱讀更多相關資訊。 diff --git a/build.gradle.kts b/build.gradle.kts index 445eb0f2..fd2df21d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -33,7 +33,7 @@ val androidMinSdkVersion by extra(26) val androidTargetSdkVersion by extra(34) val androidCompileSdkVersion by extra(34) val androidBuildToolsVersion by extra("34.0.0") -val androidCompileNdkVersion by extra("26.0.10792818") +val androidCompileNdkVersion by extra("27.2.12479018") val androidSourceCompatibility by extra(JavaVersion.VERSION_11) val androidTargetCompatibility by extra(JavaVersion.VERSION_11) diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 7f93135c..a4b76b95 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 3fa8f862..df97d72b 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.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index 4f906e0c..f5feea6d 100755 --- a/gradlew +++ b/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,69 +15,104 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s +' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -87,9 +122,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -98,88 +133,120 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac fi -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. # For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) fi - i=`expr $i + 1` + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index 107acd32..9b42019c 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,89 +1,94 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/loader/build.gradle.kts b/loader/build.gradle.kts index 144ffba6..442f3a24 100644 --- a/loader/build.gradle.kts +++ b/loader/build.gradle.kts @@ -49,6 +49,7 @@ android { externalNativeBuild.cmake { path("src/CMakeLists.txt") + buildStagingDirectory = layout.buildDirectory.get().asFile } defaultConfig { diff --git a/loader/src/CMakeLists.txt b/loader/src/CMakeLists.txt index c8dc73a9..84ba7b99 100644 --- a/loader/src/CMakeLists.txt +++ b/loader/src/CMakeLists.txt @@ -3,6 +3,8 @@ project("loader") find_package(cxx REQUIRED CONFIG) +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) + add_definitions(-DZKSU_VERSION=\"${ZKSU_VERSION}\") aux_source_directory(common COMMON_SRC_LIST) diff --git a/loader/src/common/elf_util.cpp b/loader/src/common/elf_util.cpp index 4ea0732a..d265b3c6 100644 --- a/loader/src/common/elf_util.cpp +++ b/loader/src/common/elf_util.cpp @@ -179,6 +179,7 @@ ElfW(Addr) ElfImg::LinearLookup(std::string_view name) const { } } } + if (auto i = symtabs_.find(name); i != symtabs_.end()) { return i->second->st_value; } else { @@ -186,6 +187,33 @@ ElfW(Addr) ElfImg::LinearLookup(std::string_view name) const { } } +std::string_view ElfImg::LinearLookupByPrefix(std::string_view name) const { + if (symtabs_.empty()) { + symtabs_.reserve(symtab_count); + if (symtab_start != nullptr && symstr_offset_for_symtab != 0) { + for (ElfW(Off) i = 0; i < symtab_count; i++) { + unsigned int st_type = ELF_ST_TYPE(symtab_start[i].st_info); + const char *st_name = offsetOf(header, symstr_offset_for_symtab + + symtab_start[i].st_name); + if ((st_type == STT_FUNC || st_type == STT_OBJECT) && symtab_start[i].st_size) { + symtabs_.emplace(st_name, &symtab_start[i]); + } + } + } + } + + auto size = name.size(); + for (auto symtab : symtabs_) { + if (symtab.first.size() < size) continue; + + if (symtab.first.substr(0, size) == name) { + return symtab.first; + } + } + + return ""; +} + ElfImg::~ElfImg() { //open elf file local diff --git a/loader/src/include/elf_util.h b/loader/src/include/elf_util.h index 95559f8e..1b8c0b73 100644 --- a/loader/src/include/elf_util.h +++ b/loader/src/include/elf_util.h @@ -48,6 +48,10 @@ namespace SandHook { } } + std::string_view findSymbolNameByPrefix(std::string_view prefix) const { + return LinearLookupByPrefix(prefix); + } + template constexpr T getSymbAddress(std::string_view name) const { return reinterpret_cast(getSymbAddress(name)); @@ -72,6 +76,8 @@ namespace SandHook { ElfW(Addr) LinearLookup(std::string_view name) const; + std::string_view LinearLookupByPrefix(std::string_view name) const; + constexpr static uint32_t ElfHash(std::string_view name); constexpr static uint32_t GnuHash(std::string_view name); diff --git a/loader/src/include/solist.hpp b/loader/src/include/solist.hpp index 5feb94d3..c65798b6 100644 --- a/loader/src/include/solist.hpp +++ b/loader/src/include/solist.hpp @@ -5,99 +5,175 @@ #include #include "elf_util.h" +#include "logging.h" -namespace SoList -{ - class SoInfo { - public: -#ifdef __LP64__ +namespace SoList { + class SoInfo { + public: + #ifdef __LP64__ inline static size_t solist_next_offset = 0x30; constexpr static size_t solist_realpath_offset = 0x1a8; -#else + #else inline static size_t solist_next_offset = 0xa4; constexpr static size_t solist_realpath_offset = 0x174; -#endif + #endif - inline static const char *(*get_realpath_sym)(SoInfo *) = nullptr; - inline static const char *(*get_soname_sym)(SoInfo *) = nullptr; + inline static const char *(*get_realpath_sym)(SoInfo *) = NULL; + inline static const char *(*get_soname_sym)(SoInfo *) = NULL; - inline SoInfo *get_next() { - return *(SoInfo **) ((uintptr_t) this + solist_next_offset); - } + inline SoInfo *get_next() { + return *(SoInfo **) ((uintptr_t) this + solist_next_offset); + } - inline const char *get_path() { - return get_realpath_sym ? get_realpath_sym(this) : ((std::string *) ((uintptr_t) this + solist_realpath_offset))->c_str(); - } + inline const char *get_path() { + if (get_realpath_sym) return get_realpath_sym(this); - inline const char *get_name() { - return get_soname_sym ? get_soname_sym(this) : *((const char **) ((uintptr_t) this + solist_realpath_offset - sizeof(void *))); - } + return ((std::string *) ((uintptr_t) this + solist_realpath_offset))->c_str(); + } - void nullify_name() { - const char** name = (const char**)get_soname_sym(this); + inline const char *get_name() { + if (get_soname_sym) return get_soname_sym(this); - static const char* empty_string = ""; - *name = reinterpret_cast(&empty_string); - } + return ((std::string *) ((uintptr_t) this + solist_realpath_offset - sizeof(void *)))->c_str(); + } - void nullify_path() { - const char** name = (const char**)get_realpath_sym(this); + void set_next(SoInfo *si) { + *(SoInfo **) ((uintptr_t) this + solist_next_offset) = si; + } + }; - static const char* empty_string = ""; - *name = reinterpret_cast(&empty_string); - } - }; + class ProtectedDataGuard { + public: + ProtectedDataGuard() { + if (ctor != nullptr) + (this->*ctor)(); + } - static SoInfo *solist = nullptr; - static SoInfo *somain = nullptr; + ~ProtectedDataGuard() { + if (dtor != nullptr) + (this->*dtor)(); + } - template - inline T *getStaticPointer(const SandHook::ElfImg &linker, const char* name) - { - auto *addr = reinterpret_cast(linker.getSymbAddress(name)); - return addr == nullptr ? nullptr : *addr; - } + static bool setup(const SandHook::ElfImg &linker) { + ctor = MemFunc{.data = {.p = reinterpret_cast(linker.getSymbAddress( + "__dl__ZN18ProtectedDataGuardC2Ev")), .adj = 0}}.f; + dtor = MemFunc{.data = {.p = reinterpret_cast(linker.getSymbAddress( + "__dl__ZN18ProtectedDataGuardD2Ev")), .adj = 0}}.f; + return ctor != nullptr && dtor != nullptr; + } - static void NullifySoName(const char* target_name) { - for (auto *iter = solist; iter; iter = iter->get_next()) { - if (iter->get_name() && iter->get_path() && strstr(iter->get_path(), target_name)) { - iter->nullify_path(); - LOGI("Cleared SOList entry for %s", target_name); - } - } + ProtectedDataGuard(const ProtectedDataGuard &) = delete; + + void operator=(const ProtectedDataGuard &) = delete; + + private: + using FuncType = void (ProtectedDataGuard::*)(); - for (auto *iter = somain; iter; iter = iter->get_next()) { - if (iter->get_name() && iter->get_path() && strstr(iter->get_path(), target_name)) { - iter->nullify_path(); - break; - } + static FuncType ctor; + static FuncType dtor; + + union MemFunc { + FuncType f; + + struct { + void *p; + std::ptrdiff_t adj; + } data; + }; + }; + + + static SoInfo *solist = NULL; + static SoInfo *somain = NULL; + static SoInfo **sonext = NULL; + ProtectedDataGuard::FuncType ProtectedDataGuard::ctor = NULL; + ProtectedDataGuard::FuncType ProtectedDataGuard::dtor = NULL; + + static bool Initialize(); + + template + inline T *getStaticPointer(const SandHook::ElfImg &linker, const char *name) { + auto *addr = reinterpret_cast(linker.getSymbAddress(name)); + + return addr == NULL ? NULL : *addr; + } + + static void DropSoPath(const char* target_path) { + if (solist == NULL && !Initialize()) { + LOGE("Failed to initialize solist"); + return; + } + SoInfo *prev = NULL; + for (auto iter = solist; iter; iter = iter->get_next()) { + if (prev != NULL && iter->get_name() && iter->get_path() && strstr(iter->get_path(), target_path)) { + SoList::ProtectedDataGuard guard; + prev->set_next(iter->get_next()); + if (iter == *sonext) { + *sonext = prev; } + LOGI("Dropped solist record for %s loaded at %s", iter->get_name(), iter->get_path()); + } + prev = iter; } + } - static bool Initialize() { - SandHook::ElfImg linker("/linker"); - solist = getStaticPointer(linker, "__dl__ZL6solist"); - somain = getStaticPointer(linker, "__dl__ZL6somain"); - - if (solist != nullptr && somain != nullptr) - { - SoInfo::get_realpath_sym = reinterpret_cast(linker.getSymbAddress("__dl__ZNK6soinfo12get_realpathEv")); - SoInfo::get_soname_sym = reinterpret_cast(linker.getSymbAddress("__dl__ZNK6soinfo10get_sonameEv")); - auto vsdo = getStaticPointer(linker, "__dl__ZL4vdso"); - - for (size_t i = 0; i < 1024 / sizeof(void *); i++) - { - auto *possible_next = *(void **) ((uintptr_t) solist + i * sizeof(void *)); - if (possible_next == somain || (vsdo != nullptr && possible_next == vsdo)) - { - SoInfo::solist_next_offset = i * sizeof(void *); - break; - } - } - - return (SoInfo::get_realpath_sym != nullptr && SoInfo::get_soname_sym != nullptr); - } + static bool Initialize() { + SandHook::ElfImg linker("/linker"); + if (!ProtectedDataGuard::setup(linker)) return false; + + /* INFO: Since Android 15, the symbol names for the linker have a suffix, + this makes it impossible to hardcode the symbol names. To allow + this to work on all versions, we need to iterate over the loaded + symbols and find the correct ones. + + See #63 for more information. + */ + + std::string_view solist_sym_name = linker.findSymbolNameByPrefix("__dl__ZL6solist"); + if (solist_sym_name.empty()) return false; + + /* INFO: The size isn't a magic number, it's the size for the string: .llvm.7690929523238822858 */ + char llvm_sufix[25 + 1]; - return false; + if (solist_sym_name.length() != strlen("__dl__ZL6solist")) { + strncpy(llvm_sufix, solist_sym_name.data() + strlen("__dl__ZL6solist"), sizeof(llvm_sufix)); + } else { + llvm_sufix[0] = '\0'; } -} \ No newline at end of file + + solist = getStaticPointer(linker, solist_sym_name.data()); + if (solist == NULL) return false; + + char somain_sym_name[sizeof("__dl__ZL6somain") + sizeof(llvm_sufix)]; + snprintf(somain_sym_name, sizeof(somain_sym_name), "__dl__ZL6somain%s", llvm_sufix); + + char sonext_sym_name[sizeof("__dl__ZL6sonext") + sizeof(llvm_sufix)]; + snprintf(sonext_sym_name, sizeof(somain_sym_name), "__dl__ZL6sonext%s", llvm_sufix); + + char vsdo_sym_name[sizeof("__dl__ZL4vdso") + sizeof(llvm_sufix)]; + snprintf(vsdo_sym_name, sizeof(vsdo_sym_name), "__dl__ZL4vdso%s", llvm_sufix); + + somain = getStaticPointer(linker, somain_sym_name); + if (somain == NULL) return false; + + sonext = linker.getSymbAddress(sonext_sym_name); + if (sonext == NULL) return false; + + SoInfo *vsdo = getStaticPointer(linker, vsdo_sym_name); + if (vsdo == NULL) return false; + + SoInfo::get_realpath_sym = reinterpret_cast(linker.getSymbAddress("__dl__ZNK6soinfo12get_realpathEv")); + SoInfo::get_soname_sym = reinterpret_cast(linker.getSymbAddress("__dl__ZNK6soinfo10get_sonameEv")); + + for (size_t i = 0; i < 1024 / sizeof(void *); i++) { + auto *possible_next = *(void **) ((uintptr_t) solist + i * sizeof(void *)); + if (possible_next == somain || (vsdo != NULL && possible_next == vsdo)) { + SoInfo::solist_next_offset = i * sizeof(void *); + + break; + } + } + + return (SoInfo::get_realpath_sym != NULL && SoInfo::get_soname_sym != NULL); + } +} diff --git a/loader/src/injector/hook.cpp b/loader/src/injector/hook.cpp index 4f02f6bf..a1b715cb 100644 --- a/loader/src/injector/hook.cpp +++ b/loader/src/injector/hook.cpp @@ -582,13 +582,7 @@ void ZygiskContext::run_modules_post() { m.tryUnload(); } - // Remove from SoList to avoid detection - bool solist_res = SoList::Initialize(); - if (!solist_res) { - LOGE("Failed to initialize SoList"); - } else { - SoList::NullifySoName("jit-cache"); - } + SoList::DropSoPath("jit-cache"); // Remap as well to avoid checking of /memfd:jit-cache for (auto &info : lsplt::MapInfo::Scan()) { diff --git a/loader/src/ptracer/monitor.cpp b/loader/src/ptracer/monitor.cpp index 805b2c0c..36f4bdcd 100644 --- a/loader/src/ptracer/monitor.cpp +++ b/loader/src/ptracer/monitor.cpp @@ -117,8 +117,8 @@ struct Status { bool zygote_injected = false; bool daemon_running = false; pid_t daemon_pid = -1; - char *daemon_info; - char *daemon_error_info; + char *daemon_info = NULL; + char *daemon_error_info = NULL; }; Status status64; diff --git a/module/src/service.sh b/module/src/service.sh index d544d9d8..20a24ce6 100644 --- a/module/src/service.sh +++ b/module/src/service.sh @@ -15,7 +15,7 @@ if [ "$(which magisk)" ]; then if [ -f "$file/service.sh" ]; then cd "$file" log -p i -t "zygisk-sh" "Manually trigger service.sh for $file" - sh "$(realpath ./service.sh)" + sh "$(realpath ./service.sh)" & cd "$MODDIR" fi fi diff --git a/zygiskd/src/zygiskd.c b/zygiskd/src/zygiskd.c index 93338aeb..dcb88d8c 100644 --- a/zygiskd/src/zygiskd.c +++ b/zygiskd/src/zygiskd.c @@ -394,7 +394,7 @@ void zygiskd_start(char *restrict argv[]) { size_t msg_length = strlen("Root: , Modules: ") + strlen(impl_name) + module_list_len + 1; struct MsgHead *msg = malloc(sizeof(struct MsgHead) + msg_length); - msg->length = snprintf(msg->data, msg_length, "Root: %s, Modules: %s", impl_name, module_list); + msg->length = snprintf(msg->data, msg_length, "Root: %s, Modules: %s", impl_name, module_list) + 1; msg->cmd = DAEMON_SET_INFO; unix_datagram_sendto(CONTROLLER_SOCKET, (void *)msg, sizeof(struct MsgHead) + msg->length);