Commit Graph
100 Commits
Author SHA1 Message Date
LoveSyandJohn Wu 7fe012347a Restore JNIEnv in advance for clean env to modules 2023-04-05 09:29:59 -07:00
LoveSyandGitHub 8dae7b5451 Update installation guide 2023-04-05 01:50:45 -07:00
LoveSyandJohn Wu b0fc580860 Avoid crash when calling abandonSession 2023-04-05 00:36:51 -07:00
LoveSyandJohn Wu b505819ca2 Fix a typo 2023-04-04 12:28:08 -07:00
LoveSyandJohn Wu aa7846c1c0 No need to mount ROOTMIR if tmp_dir != /sbin 2023-04-04 02:12:07 -07:00
LoveSyandJohn Wu 15cab86152 Make module mirror read only 2023-04-02 22:03:02 -07:00
aa785b5845 Show confirm dialog when installing local module
It can avoid miss click

Co-authored-by: 南宫雪珊 <vvb2060@gmail.com>
2023-04-02 21:33:13 -07:00
LoveSyandJohn Wu 97731a519a Update zygisk API to avoid mem leak 2023-04-02 03:54:33 -07:00
LoveSyandJohn Wu 4ff60ef9a9 No more patching libc.a on 64bit platforms 2023-04-01 03:51:57 -07:00
3a4fe53f27 New way to unload zygisk
Co-authored-by: 残页 <a1364259@163.com>
2023-04-01 03:37:17 -07:00
LoveSyandtopjohnwu e48afff5e8 Compress jniLibs 2023-04-01 01:54:10 -07:00
LoveSyandJohn Wu 3921e9cb1b Fix release build 2023-03-31 00:06:55 -07:00
LoveSyandJohn Wu b5a8a27296 Update Chinese translation 2023-03-30 13:33:04 -07:00
LoveSyandJohn Wu 04324a7ebe Upgrade LSPlt to bypass a bionic bug 2023-03-23 20:56:35 -07:00
LoveSyandJohn Wu 07c22ccd39 Use app_dir to detect systemui instead
uid may be shared by other apps (e.g., in MIUI, systemui's uid
is 1000 and shared by many system apps).
2023-03-23 16:17:13 -07:00
LoveSyandJohn Wu e893c13cf1 Unlink preinit device if bind mount fails 2023-03-23 00:40:13 -07:00
LoveSyandJohn Wu dba5020e4f Refactor magiskrc 2023-03-22 17:53:15 -07:00
LoveSyandJohn Wu 87e036a190 Update LSPlt to avoid crash when hooking libc 2023-03-22 12:02:33 -07:00
LoveSyandJohn Wu 3dd94672b0 Fix preinit scripts 2023-03-22 03:07:34 -07:00
LoveSyandJohn Wu 004b193f69 Fix installation crash 2023-03-22 02:44:14 -07:00
LoveSyandJohn Wu 2eef542054 Add amonet microloader support 2023-03-21 15:50:43 -07:00
LoveSyandJohn Wu a07d4080b6 Upgrade termux-elf-cleaner to strip DT_PREINIT_ARRAY 2023-03-21 02:17:21 -07:00
LoveSyandJohn Wu b9d0a3b3d4 Use partition name or devpath's name 2023-03-21 00:40:11 -07:00
LoveSyandJohn Wu 7048aa1014 Rename sepolicy.rules -> rules 2023-03-21 00:40:11 -07:00
LoveSyandJohn Wu 1c2fcd14b5 Mount sepolicy.rules for migration 2023-03-21 00:40:11 -07:00
LoveSyandJohn Wu 4de93cfd4b Use RV to show Magisk logs 2023-03-19 23:47:29 -07:00
LoveSyandJohn Wu 03cee0b8d4 Remove meaningless umount in magiskinit
This is no longer required since we redirect to /data/magiskinit
2023-03-19 23:35:18 -07:00
LoveSyandJohn Wu 54ecc001f4 Clean up more codes 2023-03-19 23:20:19 -07:00
LoveSyandJohn Wu 5c325d9466 Fix su log with long command 2023-03-19 23:20:04 -07:00
LoveSyandJohn Wu d9f0aed571 Fix unpack -n and repack -n of ZIMAGE kernel 2023-03-17 02:00:46 -07:00
LoveSyandJohn Wu 98813c24fb Drop trailing garbage of gzip decompress
I previously refered to minigzip from libz which copies all trailing
data to the output when decompressing. However, gzip, on the other
hand, drop trailing garbage by default. Consider ZIMAGE append
the kernel size with zero padding, we should drop trailing garbage
as well.
2023-03-17 02:00:25 -07:00
LoveSyandJohn Wu 3cf66d1c57 Fix currentFocus
Looks like currentFocus does not always exist even after setContentView,
so I hereby use another way to check if setContentView is called
2023-03-09 17:52:38 -08:00
LoveSyandGitHub d130aa02a1 Do not always create new adapter 2023-03-09 16:00:08 -08:00
LoveSyandJohn Wu 1a1646795f Support untrusted_app_32 2023-03-09 02:17:30 -08:00
d52ea1b068 Postpone showMainUI when activity has stopped
Co-authored-by: topjohnwu <topjohnwu@gmail.com>
2023-03-07 21:04:04 -08:00
LoveSyandJohn Wu e14f7b6908 No KeyDispatch or OnBackPress when no currentFocus 2023-03-07 20:20:35 -08:00
LoveSyandJohn Wu 981ccabbef No support for partitions w/o symlink in /system 2023-03-06 05:23:40 -08:00
LoveSyandJohn Wu 9555380818 Replace parse_mnt with parse_mount_info 2023-03-06 05:09:12 -08:00
LoveSyandJohn Wu 1aade8f8a8 No greedy match to find parent mount point
This fixes /sys is considered as a parent mount point of /system
2023-03-03 11:09:03 -08:00
LoveSyandJohn Wu b9213b7043 Remove redundant stub.apk 2023-03-03 11:07:36 -08:00
LoveSyandtopjohnwu 4af72324f4 Fix gradle cache 2023-03-03 02:39:22 -08:00
LoveSyandJohn Wu b6ea5b8984 Fix SYSTEM_ROOT not passed to boot patch 2023-03-02 23:39:50 -08:00
LoveSyandJohn Wu 307cf87215 Fix build script 2023-03-02 20:32:46 -08:00
LoveSyandJohn Wu f59fbd5dca Filter duplicate mount points
This prevents umounting existing overlay mount points
2023-03-02 14:33:50 -08:00
LoveSyandJohn Wu da36e5bcd5 Make worker private 2023-03-02 02:25:44 -08:00
LoveSyandJohn Wu e5641d5bdb Fix avd-magisk 2023-02-27 23:00:42 -08:00
LoveSyandJohn Wu c7a27481f9 Update proguard rules to fix module page crash 2023-02-27 20:50:24 -08:00
LoveSyandJohn Wu 594c304634 Fix release build 2023-02-26 22:35:20 -08:00
LoveSyandJohn Wu a1a87c9956 Get rid of vtable hook 2023-02-26 04:59:21 -08:00
LoveSyandJohn Wu 79586ece4c Update install.md 2023-02-26 01:17:11 -08:00
LoveSyandJohn Wu 996a857096 Upgrade kotlin 2023-02-26 01:15:32 -08:00
LoveSyandJohn Wu d7158131e4 No need to manually parse mount flags 2023-02-26 01:15:18 -08:00
LoveSyandJohn Wu 78ca682bc5 Always mount tmpfs for dirs
https://android-review.googlesource.com/c/platform/system/core/+/928592
2023-02-25 18:19:46 -08:00
LoveSyandJohn Wu af01a36296 Refactor magic mount to support overlayfs
Previously, magic mount creates its own mirror devices and mount
mirror mount points. With these mirror mount points, magic mount
can get the original files and directory trees. However, some
devices use overlayfs to modify some mount points, and thus after
magic mount, the overlayed files are missing because the mirror
mount points do not contain the overlayed files. To address this
issue and make magic mount more compatible, this patch refactors
how magic mount works.

The new workflows are as follows:
1. make MAGISKTMP a private mount point so that we can create the
   private mount points there
2. for mirror mount points, we instead of creating our own mirror
   devices and mount the mirror mount points, we "copy" the
   original mount points by recursively mounting /
3. to prevent magic mount affecting the mirror mount points, we
   recursively set the mirror mount points private
4. to trace the mount points we created for reverting mounts, we
   again make the mirror mount points shared, and by this way we
   create a new peer group for each mirror mount points
5. as for tracing the newly created tmpfs mount point by magic
   mount, we create a dedicated tmpfs mount point for them, namely
   worker mount point, and obviously, it is shared as in a newly
   created peer group for tracing
6. when reverting mount points by magic mount, we can then trace
   the peer group id and unmount the mount points whose peer group
   ids are created by us

The advantages are as follows:
1. it is more compatible, (e.g., with overlayfs, fix #2359)
2. it can mount more partitions for which previous implementation
   cannot create mirror mount points (fix #3338)
2023-02-25 18:19:46 -08:00
LoveSyandJohn Wu 97ed1b16d0 Fix gzip decompression 2023-02-20 18:26:04 -08:00
LoveSyandJohn Wu 508a001753 Remove obsolete link 2023-02-20 17:25:32 -08:00
LoveSyandJohn Wu 4ba365565f Upgrade gradle 2023-02-20 00:08:23 -08:00
LoveSyandJohn Wu 79a85f5937 Use mountinfo for revert unmount 2023-02-17 12:36:19 -08:00
LoveSyandJohn Wu b249832571 Use statfs to check rootfs
This helps support adb remount
2023-02-12 22:49:27 -08:00
LoveSyandJohn Wu 577b5912af Fix SKIP_FD_SANITIZATION false positive
Fix #6523
2023-02-12 00:40:09 -08:00
9e8c68af12 Refactor sepolicy.rules resolve
We resolve available partitions for sepolicy.rules when patching
boot and bind mount the partition by magiskinit.

For older devices, the previous logic won't work because the part name
is never readable.

Co-authored-by: topjohnwu <topjohnwu@gmail.com>
2023-02-12 00:36:38 -08:00
LoveSyandJohn Wu 220a1c84ce Zygisk v4 module's plt commit should not use regex 2023-02-09 20:19:53 -08:00
LoveSyandJohn Wu 9656cf2f86 Refine 2023-02-09 20:08:44 -08:00
LoveSyandJohn Wu 0329f00129 Upgrade LSPlt
Fix #6533
2023-01-20 19:29:55 +08:00
LoveSyandJohn Wu 4318ab5cd2 Reuse tmpfs for magic mount
As we already have a tmpfs (magisktmp), we can reuse them for
magic mount
2023-01-20 03:49:40 +08:00
67845f9c21 Clear sepolicy rules when disable/remove modules
Co-authored-by: topjohnwu <topjohnwu@gmail.com>
2023-01-19 04:25:44 +08:00
LoveSyandJohn Wu aa0a2f77cf Add inode plt hook APIs 2023-01-10 02:42:45 +08:00
LoveSyandJohn Wu 37b81ad1f6 Refine module preparation return value 2022-12-26 17:17:41 -08:00
5763a3d908 Support replacing existing .rc by overlay.d
Co-authored-by: topjohnwu <topjohnwu@gmail.com>
2022-12-26 03:28:10 -08:00
LoveSyandJohn Wu 4d876f0145 Support detecting safemode by ro.sys.safemode 2022-12-24 15:16:53 -08:00
LoveSyandJohn Wu bdfedea4e0 Close missing fd
Fix #6463
2022-12-24 15:16:27 -08:00
LoveSyandJohn Wu ea0e3a09ef Update install.md 2022-12-23 17:21:44 -08:00
LoveSyandJohn Wu 4ed34cd648 Eliminate unnecessarily copy on magiskinit
This patch reuses the abused /data tmpfs for magisktmp
2022-12-23 17:03:16 -08:00
LoveSyandJohn Wu cd5384f13e Fix crashes whenever a zygisk module has ver > 4 2022-11-22 14:47:37 -08:00
11b2ddbad8 Fix zygisk v4 ApiTable abi
Also refactor some code to let the compiler check the abi

Co-authored-by: topjohnwu <topjohnwu@gmail.com>
2022-11-22 11:49:31 -08:00
LoveSyandJohn Wu 23ad611566 Use sccache for rust build 2022-09-26 01:35:52 +02:00
LoveSyandJohn Wu e86db0bd61 Reset stack guard after fork from Zygote 2022-09-13 04:18:34 -07:00
LoveSyandJohn Wu 3906fe75dc Clean up code 2022-07-21 00:52:28 -07:00
3817167ba1 Correct ro.crypto.state check
Fix #6042

Co-authored-by: vvb2060 <vvb2060@gmail.com>
2022-06-30 19:32:43 -07:00
LoveSyandGitHub 3ae7344747 Create /dev on stub cpio 2022-06-22 04:05:50 -07:00
LoveSyandGitHub 4e2ecdb920 Fix env overflow
Fix #5989
2022-06-17 02:02:44 -07:00
LoveSyandJohn Wu b4c398542a Fix signboot signature 2022-05-06 00:00:20 -07:00
LoveSyandJohn Wu 9e8218089b Only dlopen valid fd 2022-03-26 13:48:53 -07:00
LoveSyandJohn Wu 7f1f0b9048 Proper support multiple modules adding same dir 2022-03-21 15:53:49 -07:00
183e5f2ecc Fix xhook cannot hook app_process
Co-authored-by: canyie <31466456+canyie@users.noreply.github.com>
Co-authored-by: John Wu <topjohnwu@gmail.com>
2022-03-21 15:52:38 -07:00
LoveSyandJohn Wu dd5a3416bf Fix multiple modules adding the same subdirectory 2022-03-19 12:28:54 -07:00
LoveSyandJohn Wu 2fb49ad780 Don't always mock selinux enforce as "0" 2022-03-19 12:28:32 -07:00
LoveSyandtopjohnwu 69c2f407d6 Log if failed to dlopen a zygisk module 2022-03-17 02:25:31 -07:00
LoveSyandJohn Wu 7999b66c3c Refactor daemon connection 2022-03-01 03:15:38 -08:00
LoveSyandJohn Wu afa771a980 Set dlopen reserved size to unlimited 2022-02-16 23:05:17 -08:00
LoveSyandGitHub 88e8f2bf83 Proper escape : and \ when binding intent 2022-02-11 01:07:28 -08:00
LoveSyandJohn Wu c849759682 Use magiskboot to patch avd
Fix #5421
2022-02-11 00:25:07 -08:00
LoveSyandJohn Wu 8edf556c9e Fix lz4_lg compress 2022-02-10 23:50:19 -08:00
LoveSyandJohn Wu 12093a3dad Update elf-cleaner 2022-02-08 00:53:02 -08:00
LoveSyandGitHub 188546515c Fix UID tracking 2022-02-08 00:49:22 -08:00
ff7ac582f0 Refactor Zygisk loading
Co-authored-by: topjohnwu <topjohnwu@gmail.com>
2022-02-06 00:27:31 -08:00
d2c2456fbe Don't use getmntent_r from system's libc
Fix #5354

Co-authored-by: topjohnwu <topjohnwu@gmail.com>
2022-02-04 23:19:12 -08:00
e9f562a8b7 Fix abuse of fdopendir
After `fdopendir`, the fd is no longer usable. Should dup and
make use of RAII

Co-authored-by: 残页 <31466456+canyie@users.noreply.github.com>
2022-02-04 22:54:34 -08:00
LoveSyandJohn Wu 70415a396a Do not filter uid == 1000 for process info 2022-01-30 08:25:24 -08:00
LoveSyandGitHub 3c7e792167 Catch PendingIntent.CanceledException thrown from send 2022-01-27 05:29:32 -08:00