Commit Graph

83 Commits

Author SHA1 Message Date
LoveSy
bf6359abaa Fix release build 2023-06-10 13:10:54 -07:00
topjohnwu
f33f1d25d0 Move find_apk_path to Rust 2023-06-10 01:40:45 -07:00
topjohnwu
5e2ef1b7f4 Better bytes support in C++ 2023-06-06 17:11:42 -07:00
topjohnwu
2a654e5d7f Improve byte_data const correctness 2023-06-03 03:16:03 -07:00
topjohnwu
9ea9f01933 Resolve clippy errors and warnings 2023-05-31 01:08:33 -07:00
topjohnwu
c30fbdf145 Simplify logging code 2023-05-29 01:27:40 -07:00
vvb2060
dd93556ad8 Faster get magisk tmpfs path 2023-05-25 01:03:27 -07:00
topjohnwu
533aeadd38 Update cstr macro 2023-05-25 01:03:04 -07:00
topjohnwu
18d0cedbe2 Parse rule files with Rust 2023-05-24 19:11:56 -07:00
topjohnwu
8e8f01f8b5 Move project common code into include 2023-05-23 21:30:30 -07:00
topjohnwu
47d2d4e3a5 Update su cmdline parsing 2023-05-23 20:51:23 -07:00
topjohnwu
5627053b74 Move su folder into core 2023-05-23 01:36:25 -07:00
topjohnwu
0f666de5e6 Organize headers 2023-05-22 21:36:15 -07:00
topjohnwu
9fe8741a02 Export get_prop to Rust 2023-05-21 23:51:30 -07:00
topjohnwu
2bcf2e76f1 Generate cxx binding in build.rs 2023-05-19 15:16:54 -07:00
topjohnwu
91773c3311 Support only read properties from storage 2023-05-19 01:53:40 -07:00
topjohnwu
dc61033b2c Support persist props bypassing property_service 2023-05-18 23:36:46 -07:00
topjohnwu
f8d62a4b6c Move resetprop under core 2023-05-18 22:15:49 -07:00
topjohnwu
cd7a335d0f Cleanup implementation 2023-05-18 20:26:20 -07:00
topjohnwu
f36b21bae5 Support get property context
Co-authored-by: canyie <a1364259@163.com>
Co-authored-by: vvb2060 <vvb2060@gmail.com>
2023-05-18 14:46:36 -07:00
topjohnwu
1be647a279 Put all FFI into same module 2023-05-16 02:41:39 -07:00
topjohnwu
22d05ca399 Update time handling code 2023-05-13 02:38:03 -07:00
LoveSy
b9e6937996 Make magisk node ro as well 2023-05-10 00:13:18 -07:00
topjohnwu
583ffc8177 Reduce cpp logging overhead 2023-05-09 19:14:08 -07:00
topjohnwu
7518092ad2 Implement logging purely in Rust 2023-05-09 18:54:38 -07:00
topjohnwu
d364554425 Remove unused code 2023-05-06 01:48:47 -07:00
vvb2060
9f7d410959 Use pathname local socket 2023-05-06 00:04:11 -07:00
vvb2060
bc94ea4334 Update SELinux policy 2023-05-06 00:04:11 -07:00
LoveSy
52a98cbd51 Temp workaround for module file context 2023-04-10 19:30:37 -07:00
topjohnwu
b4ae3493a6 Use ext4 partitions for preinit first
Fix #6841, close #6847
2023-04-08 20:30:40 -07:00
残页
1a16004b20
Add help message for magisk --preinit-device 2023-04-08 18:32:34 -07:00
LoveSy
b505819ca2 Fix a typo 2023-04-04 12:28:08 -07:00
vvb2060
69529ac59c Fix restorecon 2023-04-04 02:34:16 -07:00
topjohnwu
24ba4ab95b Better AVD support 2023-04-04 02:04:49 -07:00
topjohnwu
762b70ba9d Better string split implementation 2023-04-03 18:50:36 -07:00
LoveSy
15cab86152 Make module mirror read only 2023-04-02 22:03:02 -07:00
LoveSy
e893c13cf1 Unlink preinit device if bind mount fails 2023-03-23 00:40:13 -07:00
LoveSy
dba5020e4f Refactor magiskrc 2023-03-22 17:53:15 -07:00
LoveSy
b9d0a3b3d4 Use partition name or devpath's name 2023-03-21 00:40:11 -07:00
topjohnwu
76405bd984 Add more comments 2023-03-21 00:40:11 -07:00
topjohnwu
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
LoveSy
7048aa1014 Rename sepolicy.rules -> rules 2023-03-21 00:40:11 -07:00
LoveSy
1c2fcd14b5 Mount sepolicy.rules for migration 2023-03-21 00:40:11 -07:00
vvb2060
362eea741f Refactor sepolicy.rules resolve native
Co-authored-by: LoveSy <shana@zju.edu.cn>
2023-03-21 00:40:11 -07:00
南宫雪珊
4709a32641
Fix mkdir
Co-authored-by: LoveSy <shana@zju.edu.cn>
2023-03-07 01:47:26 -08:00
LoveSy
981ccabbef No support for partitions w/o symlink in /system 2023-03-06 05:23:40 -08:00
vvb2060
9e07eb592c Fix make private before remount 2023-03-06 05:18:16 -08:00
topjohnwu
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
LoveSy
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
LoveSy
da36e5bcd5 Make worker private 2023-03-02 02:25:44 -08:00