Commit Graph

362 Commits

Author SHA1 Message Date
ThePedroo
70697be9a5 fix: ptrace_message leaking ReZygisk existence (zygote pid)
This commit fixes a trace left due to a kernel bug. In some cases (and all of them here), the sequence of events may lead to "ptrace_message" not be properly reset/not represent the actual state. This happens here, as when TRACEFORK is set in "monitor.c", setting "ptrace_message" as the PID of the new process, persists even when not tracing anymore, causing leaks.

This fix has been given by @nampud, in #171.
2025-05-27 19:32:20 -03:00
ThePedroo
6261466e44 fix: Zygisk module loading
This commit fixes the issue where ReZygisk would try to load Zygisk modules after umounting mounts, leading to them not being found anymore.
2025-05-25 01:10:25 -03:00
ThePedroo
d455117c49 fix: injection when libdl.so is not in apex
This commit fixes the issue where "libdl.so" wouldn't be found, when trying to inject "lizygisk.so", in systems where apex is in "/system/lib/libdl.so".
2025-05-23 12:27:15 -03:00
ThePedroo
6272e0a2ac improve: ReZygiskd umount code by unifying; improve: umount system by making umount if less strict
This commit both improves ReZygiskd umount system by unifying all root implementations code into a single one, and also by making it less strict to umount.
2025-05-20 14:25:39 -03:00
ThePedroo
62481ca2b6 fix: wrong logic for detecting leaked fds; add: leaked fd warning
This commit fixes the logic issue which made leaked fds not be closed by "libzygisk.so", causing crashes for some. It also adds a warning for when it finds a leaked fd, so that module developers can be notified.

fixes #163
2025-05-20 14:20:37 -03:00
ThePedroo
98f88916b8 update: module id
Historically "zygisksu" is the ZygiskOnKernelSU (known as Zygisk Next) module id, which due to ReZygisk being a fork of Zygisk Next, was used by it. To avoid conflicts in systems like MMRL, we decided to change it to "rezygisk". This, however, will allow both to be installed in the same system, although causing problems, as a side effect. The old module, with the old module id, must be uninstalled while the new one is installed.

closes #113
2025-05-18 20:10:14 -03:00
ThePedroo
ed347e879e add: misaki.sig for zip-level build integrity
This commit adds Misaki, a new ReZygisk system to help improve safety in the root community, by allowing users to check whether a build is official or not with the use of tools like SignSee.
Name credits for Anonymous, in The PerformanC Organization Telegram chat.
2025-05-18 17:18:10 -03:00
ThePedroo
ea49b887ab add: signed CIs for main branch
This commit makes the "main" branch CI builds signed from now on.
2025-05-18 16:43:29 -03:00
Alice w/🌧️
4de1b443cf add: ReZygisk WebUI (#73)
This commit adds the ReZygisk WebUI to ReZygisk.

Signed-off-by: Emulond Argent <108662981+Emulond@users.noreply.github.com>
Signed-off-by: WinCS <94188592+Meltartica@users.noreply.github.com>
Signed-off-by: Pedro.js <pedroolimpioguerra@gmail.com>
Signed-off-by: unexpected unresolved <minh15052008@gmail.com>
Signed-off-by: SheepChef <50871867+SheepChef@users.noreply.github.com>
Signed-off-by: AJleKcAHgP68 <78802768+AJleKcAHgP68@users.noreply.github.com>
Signed-off-by: Blazzycrafter <39300111+Blazzycrafter@users.noreply.github.com>
Signed-off-by: Igor <sorocean.igor@gmail.com>
Signed-off-by: unexpected unresolved <xeondev@xeondex.onmicrosoft.com>
Signed-off-by: Kirill Kuznetsov <kdevlab@yandex.ru>
Signed-off-by: Lucky Kiddos <95188840+GuitarHeroStyles@users.noreply.github.com>
Signed-off-by: Kitty <73357005+Kittyskj@users.noreply.github.com>
Signed-off-by: GhostFRR <ghost.game.fr@gmail.com>
Signed-off-by: Alice w/🌧️ <rainyxeon@gmail.com>
Signed-off-by: ZGX089ッ <159061718+ZG089@users.noreply.github.com>
Signed-off-by: thasave14 <93542339+thasave14@users.noreply.github.com>
Co-authored-by: ThePedroo <pedroolimpioguerra@gmail.com>
Co-authored-by: ExtremeXT <75576145+ExtremeXT@users.noreply.github.com>
Co-authored-by: Emulond Argent <108662981+Emulond@users.noreply.github.com>
Co-authored-by: RainyXeon <xeondev@xeondex.onmicrosoft.com>
Co-authored-by: Fyphen <fyphensub@gmail.com>
Co-authored-by: WinCS <94188592+Meltartica@users.noreply.github.com>
Co-authored-by: CaptainThrowback <captainthrowback@hotmail.com>
Co-authored-by: Kirill Kuznetsov <kdevlab@yandex.ru>
Co-authored-by: SheepChef <50871867+SheepChef@users.noreply.github.com>
Co-authored-by: AJleKcAHgP68 <78802768+AJleKcAHgP68@users.noreply.github.com>
Co-authored-by: Blazzycrafter <39300111+Blazzycrafter@users.noreply.github.com>
Co-authored-by: Igor <sorocean.igor@gmail.com>
Co-authored-by: Berlian Panca <53902591+bpanca05@users.noreply.github.com>
Co-authored-by: Willow Hayley Lovelace <65596971+dyingwillow@users.noreply.github.com>
Co-authored-by: witch <witch@dyingwillow.dev>
Co-authored-by: Lucky Kiddos <95188840+GuitarHeroStyles@users.noreply.github.com>
Co-authored-by: Kitty <73357005+Kittyskj@users.noreply.github.com>
Co-authored-by: GhostFRR <ghost.game.fr@gmail.com>
Co-authored-by: ZGX089ッ <159061718+ZG089@users.noreply.github.com>
Co-authored-by: thasave14 <93542339+thasave14@users.noreply.github.com>
Co-authored-by: Flopster101 <nahuelgomez329@gmail.com>
Co-authored-by: Lxchoooo <155797099+Lxchoooo@users.noreply.github.com>
2025-05-18 13:14:42 -03:00
Fyphen
bdcb67b1f9 add: Japanese README.md translations (#162)
This commit adds Japanese (ja-JP) translations of the "README.md"

Signed-off-by: Fyphen <fyphensub@gmail.com>
2025-05-18 11:45:07 -03:00
ThePedroo
54584410ce improve: flexibility of modules to modify mounts in app_specialize_pre
This commit improves the flexibility of modules to modify mounts in "preAppSpecialize" in denylisted apps, which would later be setns to a new namespace, after executing Zygisk modules "preAppSpecialize".
2025-05-16 17:07:42 -03:00
Pedro.js
7993278a5f update: READMEs information; remove: outdated READMEs (#146)
This commit updates the information in ReZygisk "README.md" and its translations, and it also removes the ones that were not updated.

Signed-off-by: Lucky Kiddos <95188840+GuitarHeroStyles@users.noreply.github.com>
Signed-off-by: GhostFRR <ghost.game.fr@gmail.com>
Signed-off-by: Alice w/🌧️ <rainyxeon@gmail.com>
Co-authored-by: GhostFRR <ghost.game.fr@gmail.com>
Co-authored-by: Lucky Kiddos <95188840+GuitarHeroStyles@users.noreply.github.com>
Co-authored-by: Alice w/🌧️ <rainyxeon@gmail.com>
2025-05-16 17:02:16 -03:00
ThePedroo
57cd281119 fix: missing 64-bit machikados in unsigned builds
This commit fixes the issue where the "machikado" files for 64-bit archs wouldn't be written as the else for unsigned builds only wrote two files.
2025-05-07 01:56:14 -03:00
ThePedroo
16c4d62cd8 fix: solist_drop_so_path explanation comment correctness
This commit fixes the explanation of why "solist_drop_so_path". ReZygisk does not "dlclose" in ptracer, and doesn't "dlclose" libzygisk.so at any point, but clean SoInfo traces then munmaps it later.
2025-05-07 01:56:12 -03:00
ThePedroo
313822ddcd improve: ELF utils, libzygisk.so injection
This commit improves ELF utils, so that it can now retrieve symbols in other ways, like dynamic symbols or utilizing GNU hash. With the improved ELF utils, "libzygisk.so" injection in ptracer was improved, replacing the use of "dlopen" and "dlsym" in the function to get remote symbol address with the use of ELF utils, also allowing higher compatibility by using linker's dlopen, dlsym, dlerror when libdl.so is not loaded in Zygote.
2025-05-07 01:56:10 -03:00
ThePedroo
68f1b1fb35 add: machikado per architecture
This commit makes the building system create one machikado per arch, from 2 to 4, so that integrity can be checked properly in 64-bit only and 32-bit only devices.
2025-05-07 01:56:07 -03:00
ThePedroo
96123aa53c add: 32-bit only environment support
This commit adds support for devices that are only capable of running 32-bit code, be it due to Android ROM limitations of CPU limitations. It also makes ReZygisk only install necessary libraries, so if a device is 64-bit only, it won't extract 32-bit libraries.
2025-05-07 01:56:05 -03:00
ThePedroo
0d60dc0ec0 fix: ReZygiskd sending data to closed fd
This commit fixes an issue where ReZygiskd would use, in a forked child, the fd that was meant for the parent to use, and vice-versa, causing issues.
2025-04-28 23:46:18 -03:00
ThePedroo
d6961603fa fix: sanitizing fds in parent Zygote
This commit fixes the issue where ReZygisk would sanitize fds not only in the child but also in the parent.
2025-04-28 17:12:40 -03:00
ThePedroo
0930c8cca4 fix: ReZygiskd Magisk DenyList not checking against process
This commit improves the precision of ReZygiskd check for Magisk if a process is in DenyList/SuList, as previously it used "package_name" instead of the correct "process" field.
2025-04-27 19:55:32 -03:00
ThePedroo
0c0f65998d remove: ReZygiskd dl.c
This commit removes the "dl.c" file, which was used for using "android_dlopen_ext" in a new namespace, used to isolate libraries, which is not necessary here as they are on different processes, hence "dlopen" can be used.
v1.0.0-rc.2
2025-04-26 06:02:03 -03:00
ThePedroo
dd38f230c0 fix: partially fd leak in Kitsune
This commit partially fixes the issue in Kitsune where fd would leak as MagiskSU would never be found in mounts. According to Magisk Kitsune code, it is only mounted after boot is completed. It sets a callback to call "magisk --boot-completed" when "sys.boot_completed" is 1, which mounts MagiskSU. Hence we check the same prop to see if the mns of the app is appropriate to be cached, and if boot is completed, it will cache that "ns_fd". This, however, doesn't fully fix the issue, since apps that are loaded before boot is completed, will have the fds leaking, since we cannot close them (easily), see code comments.
2025-04-26 01:54:54 -03:00
ThePedroo
d0b044a31d remove: Rooted mns state for simplification
This commit removes the "Rooted" mount namespace state, as it wouldn't fit in the categories made by root implementations. The three major root implementations divide apps into three categories: SU, Umounted, (with) Mounts. The SU one consists of apps that are allowed to elevate privileges, those don't have their mounts modified, and keep root mounts. As for Umounted, it consists of apps that will have root-related mounts umounted before being executed. And finally (with) mounts which are apps that although are not allowed to elevate privileges, still have the root-related mounts kept.
Knowing that we can merge both SU and (with) Mounts into the same category: No modification to mounts/Keep root-related mounts. With that, "Mounts" mns state is also unmodified, compared to old "Modules" mns state.

Those changes also reflect on the issue where new apps couldn't ask Magisk for root as they would have SU mount umounted, which now, as ReZygisk leave them unmodified, they can.
2025-04-25 02:11:57 -03:00
ThePedroo
00345eea7f improve: unify symtabs loading in elf_util.c
This commit improves the code in "elf_util.c" by unifying the code that loads the symtabs information in ElfImg structure.
2025-04-25 02:06:59 -03:00
ThePedroo
aac0046061 fix: memory leak in rezygisk_get_info
This commit fixes a memory leak in "rezygisk_get_info" as it would read a string from ReZygiskd but would never "free" after using it. Also call "free_rezygisk_info" instead of manually cleanup in ptracer.
2025-04-25 02:05:29 -03:00
ThePedroo
2f4f5af206 fix: missing vdso lead to unoperating SoList hiding
This commit fixes the issue where the could would return when "__dl__ZL4vdso*" wasn't found, leaving traces in SoList.
2025-04-25 02:03:58 -03:00
ThePedroo
a4c9794de0 add: error handling for UpdateMountNamespace
This commit adds the missing error handling for "UpdateMountNamespace" in both libzygisk.so and ReZygiskd, as before it would send a -1 as unsigned, leading to issues.
2025-04-25 02:02:29 -03:00
ThePedroo
a460c54d08 improve: update_mnt_ns logging; add: comment about "rooted denylisted" apps
This commit improves logging for "update_mnt_ns" function, which now specifies which state it will update the mns to, for easier debugging. It also adds a note about the possibility of having apps with rooted permissions and also be denylisted in Magisk, causing weird behavior.
2025-04-24 01:33:53 -03:00
ThePedroo
b24c74ac0d fix: not umounting KSU-specific /system mounts
This commit fixes the issue that ReZygisk would skip all "/system" mounts, and not only the ones made by modules, leaving unexpected mounts mounted in app processes. KernelSU itself create some mounts such as "/system/app", which need to be umounted. To fix that, we will check if they come from "/data/modules", and if so, skip and not umount. That's not needed in Magisk as it doesn't create such mounts as far as I am aware.
2025-04-23 13:55:22 -03:00
Pedro.js
2ff4cb6401 merge: port of more of the codebase; fix: memory and general mount bugs (#122)
This commit merges the PR that both ports common, ptracer and include (SoList) to C, and also fixes memory bugs and mount bugs.
2025-04-22 23:58:34 -03:00
ThePedroo
61ece7ee4f remove: ccache from workflows
This commit removes ccache since it doesn't provide any benefit in workflows, and makes them slower.
2025-04-21 20:04:16 -03:00
ThePedroo
7046c1d9c1 fix: merge conflicts
This commit fixes merge conflicts while merging to main.
2025-04-21 19:50:50 -03:00
ThePedroo
bd5eb4c795 fix: unexpected /data/adb umount before loading modules
This commit fixes the issue where ReZygisk would change the mount namespace (mns) before the modules were loaded, thus failing, as "/data/adb/modules" wouldn't be mounted.
2025-04-21 19:37:09 -03:00
ThePedroo
8949561ac8 fix: logging tag for ptracer, out-of-bounds access in allowed_fds
This commit fixes the logging tag for ptracer command-line tool, which would show as "zygisk-core64", the one from libzygisk, and an out-of-bounds access in "allowed_fds" array, which then the readdir returned the "." and "..", the "parse_int" would return -1, and would try to access it in "allowed_fds" without checking if it is negative, or bigger, first.
2025-04-21 15:46:28 -03:00
ThePedroo
bb8e860e3e improve: match libzygisk.so daemon action name with ReZygiskd's
This commit makes the action name for updating mnt in ReZygiskd side to match libzygisk name one.
2025-04-21 15:41:48 -03:00
GhostFRR
221b4fc997 add: French README.md translations (#129)
This commit adds the translations for French of the "README.md" file.

Signed-off-by: GhostFRR <ghost.game.fr@gmail.com>
2025-04-17 14:07:37 -03:00
Md Arif
622e23e7ec fix: wrong JNI function signature for GrapheneOS (#99)
This commit fixes the wrong signature for JNI functions of GrapheneOS's Zygote, leading to it not working on GrapheneOS.
2025-04-17 12:46:09 -03:00
ThePedroo
032cd68916 improve: magisk binary check code
This commit improves and simplifies the code that checks in which path the "magisk" binary is by using loops instead of hardcoded "if"s.
2025-04-16 02:15:52 -03:00
ThePedroo
8f70a1a451 remove: unused mazoku file
This commit removes the "mazoku" file, which is only used by Zygisk Next/Shamiko for module integrity and signing, and is not used in ReZygisk.
2025-04-16 02:12:34 -03:00
ThePedroo
db24c1c439 improve: not umount modules /system mounts
This commit creates a new behavior in ReZygisk umounting system where it now ignores "/system/..." mounts, as umounting them generally leads to unbootable system.
2025-04-16 02:06:21 -03:00
ThePedroo
b94ea0c5f5 improve: port ptracer to C
This commit ports the C++ to C99 from zygisk-ptracer code, allowing a ~3x size reduce in its binary.
2025-04-16 02:02:26 -03:00
ThePedroo
1a3f497e1a improve: port common code to C
This commit ports even more C++ code to C99, now, the codes available in the "common" folder.
2025-04-14 00:54:24 -03:00
Breathleas
c37a5b1c8e fix: missing status32 exit check (#128)
This commit fixes the issue where 32-bit daemon wouldn't be checked for exits, as the macro hardcoded "status64".

Signed-off-by: Breathleas <39123978+Breathleas@users.noreply.github.com>
Co-authored-by: anyusec <145352653+anyusec@users.noreply.github.com>
Co-authored-by: Pedro.js <pedroolimpioguerra@gmail.com>
2025-04-13 19:12:08 -03:00
Stillhard
2d80ce6935 fix: SELinux rules (#130)
This commit allows Zygote to access files in /data/adb, so that it can load the Zygisk modules.

Signed-off-by: Stillhard <indofreeserver@yahoo.co.id>
2025-04-12 23:54:35 -03:00
ThePedroo
5b3d9c75fd remove: open file helpers
This commit remove the `open_...` and `xopen_...` helpers, making the code simpler and more direct.
2025-04-12 23:26:17 -03:00
ThePedroo
4625587ea9 improve: ELF utils and SoList code
This commit improves the code related to ELF and SoList, porting them to C.
2025-04-08 16:26:19 -03:00
ThePedroo
52885faf8b remove: dl.cpp file and replace with "dlopen"
This commit replaces DlopenMem for dlopen, removing the need for "dl.cpp" file.
2025-04-05 15:52:47 -03:00
Pedro.js
886e2f8396 improve: mounting system, compatibility; remove: logging on release (#111)
This commit adds numerous improvements to the state of hidden'ility of ReZygisk, and also for compatibility. Recommended to check #111 for more information.
2025-03-29 12:17:57 -03:00
Reveny
9aafc279d5 improve: use all threads for compiling (#118)
This commit speeds up the build process by almost 50% when building with github actions by using all system threads to compile ReZygisk.
2025-03-23 15:11:33 -03:00
Reveny
92e2f528a9 add: Android 9 support (#117)
This commit makes ReZygisk load Zygisk libraries directly, not utilizing memfd, as it doesn't exist in older versions of Android.
2025-03-22 19:12:24 -03:00