Commit Graph

1770 Commits

Author SHA1 Message Date
9ea859810d Update api.hpp copyright notice 2023-04-05 01:54:56 -07:00
9279f30e89 Upload mapping and native debug symbols 2023-04-05 00:14:51 -07:00
b505819ca2 Fix a typo 2023-04-04 12:28:08 -07:00
69529ac59c Fix restorecon 2023-04-04 02:34:16 -07:00
a18a440236 Cancel recursive bind 2023-04-04 02:12:07 -07:00
aa7846c1c0 No need to mount ROOTMIR if tmp_dir != /sbin 2023-04-04 02:12:07 -07:00
24ba4ab95b Better AVD support 2023-04-04 02:04:49 -07:00
762b70ba9d Better string split implementation 2023-04-03 18:50:36 -07:00
41b77e4f25 Make base as template argument for optimization 2023-04-03 18:32:11 -07:00
2087e47300 Get random separately 2023-04-03 18:32:11 -07:00
46ce765860 Use stable random seed 2023-04-03 18:32:11 -07:00
15cab86152 Make module mirror read only 2023-04-02 22:03:02 -07:00
97731a519a Update zygisk API to avoid mem leak 2023-04-02 03:54:33 -07:00
4ff60ef9a9 No more patching libc.a on 64bit platforms 2023-04-01 03:51:57 -07:00
23b1b69110 Consolidate zygisk cleanup routines 2023-04-01 03:37:17 -07:00
3a4fe53f27 New way to unload zygisk
Co-authored-by: 残页 <a1364259@163.com>
2023-04-01 03:37:17 -07:00
04324a7ebe Upgrade LSPlt to bypass a bionic bug 2023-03-23 20:56:35 -07:00
f54daa3469 Force ramdisk format to lz4_legacy for v4 2023-03-23 20:50:27 -07:00
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
e893c13cf1 Unlink preinit device if bind mount fails 2023-03-23 00:40:13 -07:00
dba5020e4f Refactor magiskrc 2023-03-22 17:53:15 -07:00
87e036a190 Update LSPlt to avoid crash when hooking libc 2023-03-22 12:02:33 -07:00
4417997749 Make sure ro mmap region is not overwritten 2023-03-21 15:50:43 -07:00
2eef542054 Add amonet microloader support 2023-03-21 15:50:43 -07:00
b9d0a3b3d4 Use partition name or devpath's name 2023-03-21 00:40:11 -07:00
76405bd984 Add more comments 2023-03-21 00:40:11 -07:00
4e2b88b3d0 Rename rules to preinit
It is possible that we will allow more preinit files for modules.
Rename the partition and folders from rules to preinit.
2023-03-21 00:40:11 -07:00
7048aa1014 Rename sepolicy.rules -> rules 2023-03-21 00:40:11 -07:00
1c2fcd14b5 Mount sepolicy.rules for migration 2023-03-21 00:40:11 -07:00
362eea741f Refactor sepolicy.rules resolve native
Co-authored-by: LoveSy <shana@zju.edu.cn>
2023-03-21 00:40:11 -07:00
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
54ecc001f4 Clean up more codes 2023-03-19 23:20:19 -07:00
af054e4e31 Bump minSdk to 23 2023-03-17 04:24:26 -07:00
d9f0aed571 Fix unpack -n and repack -n of ZIMAGE kernel 2023-03-17 02:00:46 -07:00
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
1a1646795f Support untrusted_app_32 2023-03-09 02:17:30 -08:00
4709a32641 Fix mkdir
Co-authored-by: LoveSy <shana@zju.edu.cn>
2023-03-07 01:47:26 -08:00
981ccabbef No support for partitions w/o symlink in /system 2023-03-06 05:23:40 -08:00
9e07eb592c Fix make private before remount 2023-03-06 05:18:16 -08:00
9555380818 Replace parse_mnt with parse_mount_info 2023-03-06 05:09:12 -08:00
a1ce6f5f12 Fix race condition when switching root manager
Before this change, the root manager package name is only written into
the database after the repackaged APK is installed. In the time between
the repackaged APK being installed and the package name being written
into the database, if some operation calls `get_manager`, the Magisk
daemon will cache this result and ignore the repackaged APK, even if
the package name is set afterwards, because the cache won't be
invalidated. The result is that the repackaged manager APK will not be
recognized as the root manager, breaking the hide manager feature.

This race condition is more likely to happen when Zygisk is enabled,
because `get_manager` is called with a very high frequency in that case.

To fix the issue, we have to set the new package name into the database
BEFORE installing the repackaged APK. We also stop pruning the
database if the repackaged manager is not found, moving this logic into
the Magisk app. By doing so, we can guarantee that the instant after
the repackaged manager APK is installed, the Magisk daemon will
immediately pick it up and treat it as the root manager.

Another small optimization: when the requester is root, simply bypass
the whole database + manager package check. Since the Magisk app hiding
APK installation proces will call `su` several times to run `pm` under
different UIDs, doing this opimization will reduce the amount of
unnecessary database query + filesystem traversals.
2023-03-06 03:58:58 -08:00
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
b6ea5b8984 Fix SYSTEM_ROOT not passed to boot patch 2023-03-02 23:39:50 -08:00
f59fbd5dca Filter duplicate mount points
This prevents umounting existing overlay mount points
2023-03-02 14:33:50 -08:00
da36e5bcd5 Make worker private 2023-03-02 02:25:44 -08:00
3726eb6032 Deny init relabel to adb_data_file
Co-authored-by: 残页 <a1364259@163.com>
Co-authored-by: LoveSy <shana@zju.edu.cn>
2023-03-02 02:20:38 -08:00
4772868d6a Move REMOUNT_ROOT 2023-03-02 02:05:38 -08:00
7dbfba76bf Umount by tmpfs id 2023-02-26 14:23:11 -08:00
2a4aa95a6f Identify tmpfs used by magisk 2023-02-26 14:23:11 -08:00
a1a87c9956 Get rid of vtable hook 2023-02-26 04:59:21 -08:00