Commit Graph
100 Commits
Author SHA1 Message Date
LoveSy d2768357da Support systemlessly deleting files or folders
After we refactor the magic mount and always mount folder as tmpfs,
we can easily support deleting files or folders now. We recognize
dummy devices with major number 0 and minor number 0 as an indicator
for removing files and folders. This indicator is borrowed from
overlayfs.
2024-12-27 15:57:54 -08:00
LoveSy a6c2ba7c1e Allow kernel to relabel 2024-12-27 12:35:29 -08:00
LoveSy aae5b466fb Use rust to implement collect/reset overlay context 2024-12-27 12:35:29 -08:00
LoveSy 06616659b8 Only desugar ZipEntry's methods 2024-12-02 19:55:28 -08:00
LoveSy 377b6d0cc2 avoid desugar the Desugar class 2024-11-09 19:41:06 -08:00
LoveSy 45d91c9658 Upgrade Gradle 2024-09-15 00:14:15 -07:00
LoveSy 310be7ab47 Return exit value of action.sh 2024-09-08 01:12:30 -07:00
LoveSy 60894e458f Automatically close action fragment when action exits successfully 2024-09-08 01:12:30 -07:00
LoveSy fbebb6ac10 Add action.sh for user to manually trigger modules' functionality from app 2024-09-08 01:12:30 -07:00
LoveSy a9f8c20703 Upgrade AGP 2024-09-05 21:50:56 -07:00
LoveSy 55e78a7b1a BYD XDJA container support 2024-08-19 17:50:16 -07:00
LoveSy e9e2ecf2dd load partition_map only once 2024-08-15 10:10:18 -07:00
LoveSy 9a9e617c35 Use find_if 2024-08-15 10:10:18 -07:00
LoveSy 3a0becc783 Use parse_impl for partition_map 2024-08-15 10:10:18 -07:00
LoveSy 1db80228e8 Move worker mount to magiskinit 2024-08-15 02:39:51 -07:00
LoveSy 838e1e254d Move devpts mount to magiskinit 2024-08-15 02:39:51 -07:00
LoveSy 5a55483698 Set -fno-threadsafe-statics for crt0
Since crt0 has no pthread support, we don't need lock for statics.
2024-08-12 10:57:45 -07:00
LoveSy 278046becb Fix wrong cxx_extern return value
This fix UB
2024-08-12 02:05:26 -07:00
LoveSy 461f7e9f89 Use metadata even if it is f2fs 2024-07-24 19:02:35 -07:00
LoveSy 9cc50b20d8 Correctly handle comments in sepolicy.rule 2024-07-24 19:02:25 -07:00
LoveSy f488e9df8f Fix sepolicy rule path 2024-07-24 19:02:12 -07:00
LoveSy 0dc596e206 Update Chinese translation 2024-07-24 19:01:59 -07:00
LoveSy 0869a90fe3 Use symlink to setup preinit 2024-07-23 02:02:56 -07:00
LoveSy 2754b1dcf8 Add comment about the choice 2024-07-23 02:02:56 -07:00
LoveSy 0db6314661 Refactor preinit finding 2024-07-23 02:02:56 -07:00
LoveSy f247759a6e No need _orig to call backup 2024-07-20 21:36:26 -07:00
LoveSy de7e5bdfe7 Update comments 2024-07-20 21:36:26 -07:00
LoveSy 53a8ba8cfe Use hookJniNativeMethods to hook zygote pre/post fork 2024-07-20 21:36:26 -07:00
LoveSy f2d057baba Refine hookJniNativeMethods 2024-07-20 21:36:26 -07:00
LoveSy 93bcf2cd25 Correct debug symbol configuration 2024-07-20 20:29:58 -07:00
LoveSy 6d82515cfc No default features of pb-rs 2024-07-20 20:29:38 -07:00
LoveSy 4931825912 Fix zygisk v5 2024-07-17 10:52:16 -07:00
LoveSy a97191052b Upgrade gradle 2024-07-12 13:46:06 -07:00
LoveSy 63b0a0d96b Fix incomplete native debug symbols
See https://github.com/android/ndk/issues/2039
2024-07-11 22:31:09 -07:00
LoveSy ea4cabdfc5 Use simple property assignment 2024-07-11 22:28:59 -07:00
LoveSy 0185ddf577 Fix building on higher version of jdk 2024-07-11 22:28:59 -07:00
LoveSy 69181a6b72 Fix wrong sepolicy rule 2024-07-08 12:09:45 -07:00
LoveSyand南宫雪珊 724b94f320 Update README.MD (#8192)
Co-authored-by: 南宫雪珊 <vvb2060@gmail.com>
2024-07-08 12:02:14 -07:00
LoveSy a07b9315a5 Add riscv64 support 2024-07-02 14:34:22 -07:00
LoveSy d6e159bff9 Use pidfd in more senarios 2024-06-22 19:16:58 -07:00
LoveSy 2f710a564f allow more -v for build.py for more verbose output 2024-06-22 19:16:37 -07:00
LoveSy 19f15f16f6 Use icf to further minimize binary size 2024-06-10 14:47:26 -07:00
LoveSyandvvb2060 08ad0e74dd Upgrade deps
Co-authored-by: vvb2060 <vvb2060@gmail.com>
2024-06-06 21:11:52 -07:00
LoveSy c6f0762510 Use pidfd_open for setns
which is more efficient on newer kernel
2024-05-20 03:26:55 +08:00
LoveSy 941a363c5a Support waiting on non-exist prop 2024-05-18 13:55:33 +08:00
LoveSy 090cb4b0f9 Upgrade AGP to 8.4.0 2024-05-09 09:42:27 -07:00
LoveSy 4dc1c59040 add missing xz_dec_end 2024-04-29 22:22:47 -07:00
LoveSy 652a26d5d9 Fix comment of sepolicy 2024-04-03 21:03:41 -07:00
LoveSy 36bd00a046 Add p521 to magiskboot 2024-04-03 21:03:05 -07:00
LoveSy 4d2921e742 Rewrite sepolicy statement parsing in Rust 2024-03-20 10:12:23 -07:00
LoveSy 156b0e67ca No need extra tmpfs for worker 2024-03-19 23:21:41 -07:00
LoveSy 92b305a389 Remove unnecessary mirror for magic mount
Mirror was previously used for accessing the original file during
magic mount when we are using a tmpfs to cover the target. However,
since we introduce atomic mount, we switch all tmpfs mount in
worker and then move to the target at once. It means that we can
still access the original file when we are constructing the tmpfs
mount point. Thus we no longer need mirror.
2024-03-19 23:21:41 -07:00
LoveSy 19ea25a9d0 Upgrade AGP 2024-03-08 17:12:46 -08:00
LoveSy 2290ddeb89 Fix segfault when sepolicy.rule has empty line 2024-03-02 06:15:45 -08:00
b6c24a3a8a No more sony init.real tricks
Co-authored-by: canyie <a1364259@163.com>
Co-authored-by: vvb2060 <vvb2060@gmail.com>
2024-02-29 23:40:00 -08:00
LoveSy a8c2ae223a Avoid hexpatch /init for 2SI when possible
Previous we hexpatch /init from /system/bin/init to /data/magiskinit
to redirect the second stage init. However, some devices like sony
has /init that does not directly invoke /system/bin/init, and thus
the hexpatch fails.

In this patch, we further make use of AOSP `SwitchRoot` to help us
bind mount /data/magisk to /system/bin/init after `SwitchRoot`.

Two important assumption about 2SI are i) that the second stage init
is always /system/bin/init and ii) that the /sdcard (path after
`SwitchRoot`) is always a symlink to `/storage/self/primary`. When
these assumptions hold, during first stage init (before `SwitchRoot`)
we can bind mount magiskinit to /sdcard, and create a symlink
/storage/self/primary to /system/system/bin/init. By these steps,
during `SwitchRoot`, AOSP init will try to mount move /sdcard to
/system/sdcard. And /system/sdcard is symlink to /storage/self/primary,
it will try to mount move /sdcard to /storage/self/primary. And
/storage/self/primary in ramfs is now a symlink that points to
/system/system/bin/init, thus AOSP will try to mount move /sdcard
(which is a bind mount to magiskinit) to /system/system/bin/init.
After chroot done by AOSP init, we then have a magiskinit bind mount
on /system/bin/init, which is the second stage init.

An edge case is that some devices (like meizu) use 2SI but
does not switch root. In this case, they must already have a /sdcard
in the ramfs, thus we can check if /sdcard exists and fallback to
hexpatch.
2024-02-29 23:40:00 -08:00
LoveSy 62fc7868ac Use self implemented parse_mount_info 2024-02-27 17:03:22 -08:00
LoveSy 41fbd2a7be Upgrade gradle 2024-02-02 10:55:11 -08:00
LoveSy 5e45884af4 Use Apple Silicon for CI
https://github.blog/changelog/2024-01-30-github-actions-introducing-the-new-m1-macos-runner-available-to-open-source/
2024-02-01 15:09:42 -08:00
LoveSy 356ee1febd Code clean up 2024-01-30 11:07:37 -08:00
LoveSy cc044ccc4c Fix zygisk unload 2024-01-30 11:07:37 -08:00
LoveSy 9c638cc463 Remove rust workaround 2024-01-29 15:07:21 -08:00
LoveSy 79334b7702 One stage zygisk loading 2024-01-11 16:19:39 -08:00
LoveSy df66458db6 Check full path of init.rc instead of its dir
Some devices has `/system/etc/init/hw` but has no init.rc in it.
2024-01-11 16:18:57 -08:00
LoveSy 97705704e2 install or uninstall apk asynchronously 2024-01-11 16:16:36 -08:00
LoveSy e94d65b4b2 Add resetprop -w for waiting property change
It's very easy to wait for property change both in Java and C++,
but it's not the case in shell script. With this patch, developers
can now easily to wait for property change, just like what we have
in `.rc` files, and to wait for boot complete.
2023-12-23 00:12:42 +08:00
LoveSy 27ece3c7df Keep mirror shared before magic mount
This allows mounting during post-fs-data be kept after magic mount
2023-12-22 21:39:03 +08:00
LoveSy 06687abffc Fix magisk --stop by making mirror shared
Previously mirror is private and then unshared to zygote, which
makes magisk --stop cannot propagate umount mirror to zygote.
2023-12-22 21:39:03 +08:00
LoveSy 6cda6c2fae Upgrade github action deps 2023-12-18 16:25:56 +08:00
LoveSyand5ec1cff f41994cb52 Skip svc for ro properties
ro properties' triggers should only be triggered once, otherwise it
may undefined behaviour.
This patch avoids triggering ro properties' actions again when using
resetprop to modify them.

Co-authored-by: 5ec1cff <ewtqyqyewtqyqy@gmail.com>
2023-12-18 16:21:08 +08:00
LoveSy 401090d6fe Avoid zygiskd restarts when boot-complete 2023-12-18 16:21:08 +08:00
LoveSy 90dcc1cd30 Do not always zero initialize for rust resize vec 2023-12-18 16:21:08 +08:00
LoveSy 2ac464b186 Only compress regular file 2023-12-18 16:21:08 +08:00
LoveSy 8b7fae278b Support compressing during cpio backup 2023-12-18 16:21:08 +08:00
LoveSy d7750b7220 uiautomator dump to /data/local/tmp 2023-12-13 03:28:30 +08:00
LoveSy 98861f0b5a Clone dir attr for tmpfs in advance 2023-12-13 03:28:30 +08:00
LoveSy f7e471616d Fix clone_attr for newly created dirs 2023-12-10 23:37:47 +08:00
LoveSy 1fd49e4987 Make tmpfs mount of magic mount atomic
This avoid system libraries disappear temporarily during magic mount,
which causes some dynamic executables fails to run during post-fs-data.
2023-12-08 13:59:02 +08:00
LoveSy d49b02b274 Fix zygiskd not restart when zygote restarts 2023-12-07 20:44:44 +08:00
LoveSy d47e70cfaa Fix native symbol strips
`ndkVersion` is also needed by app for striping native symbols.
Set it in `setupCommon` instead.
2023-12-04 00:37:09 +08:00
LoveSy 4e99997013 Upgrade AGP 2023-12-02 15:25:58 +08:00
LoveSy 334554697d Enable rust parallel front-end
See https://blog.rust-lang.org/2023/11/09/parallel-rustc.html
2023-12-02 15:25:41 +08:00
LoveSy e77cbd0c15 Upgrade gradle 2023-11-30 11:49:40 +08:00
LoveSy 58aded31c2 Enable iter_intersperse 2023-11-29 23:47:51 +08:00
LoveSy 6f6b0ade06 Correct cpio's norm_path 2023-11-29 23:47:51 +08:00
LoveSyandtopjohnwu fce1bf2365 Obtain NativeBridgeRuntimeCallbacks for future use
NativeBridgeRuntimeCallbacks can be used for better JNI method hooking

Co-authored-by: topjohnwu <topjohnwu@gmail.com>
2023-11-07 16:56:40 -08:00
LoveSy cbc6d40b2c Clean up codes 2023-11-07 14:25:57 -08:00
9fbd079560 Refactor zygisk to use native bridge to inject
Co-authored-by: vvb2060 <vvb2060@gmail.com>
Co-authored-by: topjohnwu <topjohnwu@gmail.com>
2023-11-07 14:25:57 -08:00
LoveSy 42eb928054 Inject zygisk.rc for sync --zygisk-restart 2023-11-06 15:39:48 -08:00
LoveSy 9088b584f6 Use official argh 2023-10-25 15:14:16 -07:00
LoveSy 8d7c7c3dfb Refactor dtb in rust 2023-09-19 00:41:42 -07:00
LoveSy 927cd571f8 Fix read_cert crash when receive fd = -1 2023-09-18 22:32:32 -07:00
LoveSy 5fbd3e5c65 Fix buf len update of read_link to Utf8CStrBuf 2023-09-18 22:31:12 -07:00
LoveSy 877aeb66cb Upgrade to Gradle 8.3 2023-09-14 13:16:59 -07:00
LoveSy 0243610c09 No trailing zeros if the signed boot img is larger 2023-09-12 18:09:20 -07:00
LoveSy 8d81bd0e33 resetprop: replace nanopb with quick-protobuf for persist 2023-09-05 22:20:57 -07:00
LoveSy c072b4254d Wrap rename and renameat 2023-09-02 04:24:24 -07:00
LoveSy 0a07018fec No need to use submodule for argh 2023-07-06 15:28:39 -07:00
LoveSy 64c82e1f2c Refine cpio argh
we can use argh to handle `--help` now
2023-07-06 15:07:06 -07:00
LoveSy af2207433d Fix error logging
ok_or will unconditionally creates a LoggedResult, which prints
an error even it successes. Use ok_or_else which lazily creates
a LoggedResult only if it fails.
2023-07-06 11:01:57 -07:00