Commit Graph

408 Commits

Author SHA1 Message Date
topjohnwu
d0c4226997 Proper package state management 2022-05-29 23:31:57 -07:00
topjohnwu
4ea8bd0229 Fix incorrect use of compare_exchange 2022-05-29 22:19:56 -07:00
vvb2060
d19fcd5e21 Check path when start daemon 2022-05-29 09:08:05 -07:00
topjohnwu
490a784993 Handle zygote restarts 2022-05-28 22:39:44 -07:00
topjohnwu
9c774f96db Use exec for boot_complete 2022-05-28 16:53:04 -07:00
topjohnwu
8dfb30fefe Skip cert check on debug builds 2022-05-24 05:39:16 -07:00
topjohnwu
2a252d13b8 Enforce dyn APK signature in stub app 2022-05-24 05:21:36 -07:00
topjohnwu
083ef803fe Enforce package signature verification 2022-05-20 04:37:58 -07:00
topjohnwu
351f0269ae Install stub if necessary 2022-05-19 22:54:49 -07:00
topjohnwu
a29ae15ff7 Proper get_manager implementation 2022-05-19 02:39:57 -07:00
topjohnwu
975b1a5e36 Prune unused UIDs from su policies 2022-05-18 01:55:58 -07:00
topjohnwu
622e09862a Restructure native codebase 2022-05-12 02:03:51 -07:00
topjohnwu
029422679c Remove enforcement
Enforcement will be re-implemented later
2022-05-11 21:12:37 -07:00
vvb2060
05d6d2b51b Verify app signature 2022-05-11 21:12:37 -07:00
topjohnwu
90545057e9 Always initialize module_list
Close #5712
2022-05-06 01:40:19 -07:00
canyie
4f1a1879e5 Misc QoL changes
- su: Preserve correct capacity to avoid vector reallocation
- su: Properly format code
- daemon: Remove useless `if`
- docs: Remove outdated info
2022-05-06 01:01:58 -07:00
topjohnwu
134508193d Mock selinuxfs load with regular file
The hijacked load node does not need to be a FIFO. A FIFO is only
required for blocking init's control flow, which is already achieved
by hijacking the enforce node.
2022-04-16 07:28:20 -07:00
vvb2060
f97866a961 Close stub fd 2022-04-13 23:19:14 -07:00
vvb2060
e1987c42c4 Cleanup SELinux mock files 2022-04-13 23:18:55 -07:00
vvb2060
9de6e8846b Dump stub app to MAGISKTMP/stub.apk 2022-04-07 23:20:42 -07:00
vvb2060
01a1213463 /data/adb/magisk/magisk.apk no longer exists 2022-04-07 23:20:42 -07:00
canyie
448384af06 Guard su request IPC
Previously `read_string()` calls `std::string.resize()` with a int read from remote process. When I/O error occurs, -1 will be used for resizing the string, `std::bad_alloc` is thrown and since magisk is compiled with `-fno-exceptions`, it will crash the whole daemon process.

May fix topjohnwu#5681
2022-04-06 21:15:07 -07:00
topjohnwu
efb3239cbd Drop package_name column 2022-03-28 02:05:09 -07:00
topjohnwu
7e7ddeb9e2 Cleanup database migration code 2022-03-28 00:59:16 -07:00
LoveSy
7f1f0b9048 Proper support multiple modules adding same dir 2022-03-21 15:53:49 -07:00
LoveSy
dd5a3416bf Fix multiple modules adding the same subdirectory 2022-03-19 12:28:54 -07:00
topjohnwu
fa8900be65 Use standalone magiskpolicy 2022-03-17 03:15:39 -07:00
topjohnwu
563a587882 Initialize local variables
Fix #5542
2022-03-09 20:43:42 -08:00
topjohnwu
548d70f30c Mount with original option
Fix #5481, close #5486
2022-03-01 20:09:59 -08:00
topjohnwu
9968af0785 Move all permission check into daemon.cpp 2022-03-01 03:15:38 -08:00
topjohnwu
be7586137c Reduce C++ wizardry 2022-03-01 03:15:38 -08:00
LoveSy
7999b66c3c Refactor daemon connection 2022-03-01 03:15:38 -08:00
vvb2060
c82a46c1ee Check property before switch mem cgroup 2022-02-28 23:27:23 -08:00
topjohnwu
d021bca6ef Prevent app_process from setting umask
Fix #5435
2022-02-11 01:26:24 -08:00
LoveSy
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
LoveSy
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
topjohnwu
fbe17dde03 Add flag for unloaded Zygisk modules 2022-01-21 05:37:47 -08:00
vvb2060
f443cbaa2b Revert "Always run non disabled module post-fs-data scripts"
This reverts commit 4dfb193d10.
2022-01-18 04:48:47 -08:00
topjohnwu
bb7a74e4b4 Add Zygisk API getFlags() 2022-01-17 19:54:33 -08:00
topjohnwu
76ddfeb93a Allow modifying denylist without enforcement 2022-01-15 23:46:22 -08:00
LoveSy
c38b826abf Skip overlayfs for post-fs-data mount
adb remount will introduce overlayfs for /system and /vendor, we should
skip mounting as overlayfs. This also helps us support overlayfs Magisk
later.
2022-01-14 03:42:37 -08:00
topjohnwu
21d7db0959 Add new Zygisk API to get module dir 2022-01-14 03:10:02 -08:00
残页
880b348ce6 Add an old cgroup path
Fix topjohnwu#5125
cgroup root path might be mem cgroup instead of acct, especially on low-ram devices.
bc131c3244%5E%21/#F0
2021-12-28 17:12:15 -08:00
topjohnwu
fef44bd24f Allow boot scripts to know Zygisk status 2021-11-20 13:05:15 -08:00
topjohnwu
4dfb193d10 Always run non disabled module post-fs-data scripts 2021-11-16 21:29:13 -08:00
vvb2060
d4ac458d17 Ignore zygisk modules when zygisk is not enabled 2021-11-16 21:14:35 -08:00
topjohnwu
8bd0c44e83 Replace module fd with memfd if possible 2021-10-28 00:26:18 -07:00
topjohnwu
ea75a09f95 Make zygisk survive zygote restarts
Close #4777
2021-10-27 01:53:16 -07:00
LoveSy
49abfcafed Fix nullptr dereference when env abnormal 2021-10-26 00:40:00 -07:00
vvb2060
2e299b3814 Add an old cgroup v2 path
https://android-review.googlesource.com/c/platform/system/core/+/1324649
2021-10-25 20:54:19 -07:00