LoveSy
78f5cd55c7
Use lzma-rust2 for xz and lzma compression and decompression
2025-08-24 00:23:55 -07:00
topjohnwu
9787a69528
Make all decoders Read instead of Write
...
Most libraries only implement Read for decoders
2025-08-24 00:23:55 -07:00
topjohnwu
87b8fe374d
Fix magiskboot cli parsing
2025-08-23 20:31:15 -07:00
topjohnwu
7b706bb0cb
Cleanup and fix compress/decompress command
2025-08-23 20:31:15 -07:00
topjohnwu
c1491b8d2b
Fix LoggedResult implementation error
2025-08-23 15:25:52 -07:00
LoveSy
5cbaf2ae11
Use super let to simplify code
2025-08-22 12:05:44 -07:00
topjohnwu
8ebc6207b4
Merge headers
2025-08-22 12:03:47 -07:00
topjohnwu
7848ee616b
Cleanup magiskboot main function
2025-08-22 12:03:47 -07:00
topjohnwu
fd193c3cae
Simplify ResultExt implementation
...
Also introduce OptionExt
2025-08-22 12:03:47 -07:00
topjohnwu
36d33c7a85
Make log_err directly return LoggedResult
2025-08-22 12:03:47 -07:00
topjohnwu
5caf28d27c
Hide harmless error reporting
2025-08-22 12:03:47 -07:00
topjohnwu
2c39d0234d
Fix compression format detection
2025-08-21 12:21:22 -07:00
topjohnwu
c313812129
Simplify magiskboot FFI
2025-08-21 12:21:22 -07:00
topjohnwu
af51880a81
Introduce CmdArgs for argument parsing in Rust
2025-08-21 12:21:22 -07:00
LoveSy
db8d832707
Move magiskboot cli to argh
2025-08-20 21:40:34 -07:00
Wang Han
8dc23d0ead
Avoid triggering magisk --zygote-restart twice
...
We have already used on restart keyword to inject zygote restart, so
triggering it here on prop is not needed.
2025-08-20 12:34:39 -07:00
topjohnwu
8d10ab89f2
Set zygisk properties in Rust
2025-08-20 11:23:18 -07:00
topjohnwu
49fdc1addb
Prevent setting zygisk prop twice
2025-08-20 11:23:18 -07:00
LoveSy
da937a88c8
if !restore { set_zygisk_prop(); }
2025-08-15 16:45:01 -07:00
topjohnwu
9476e7282d
More borrowing, less copying
2025-08-08 21:06:41 -07:00
topjohnwu
251c3c3e0e
Remove old ffi data structure
2025-08-08 21:06:41 -07:00
topjohnwu
cd0eca20b0
Migrate connect.cpp to Rust
2025-08-08 21:06:41 -07:00
topjohnwu
6839cb9ab2
Keep /system/xbin/su on emulators
2025-08-08 21:06:41 -07:00
topjohnwu
d11a3397d8
Reduce verbose logging in Zygisk
2025-08-08 21:06:41 -07:00
topjohnwu
e489b3b6dd
Migrate load_modules to Rust
2025-08-05 11:24:55 -07:00
topjohnwu
589a270b8d
Migrate disable/remove modules to Rust
2025-08-05 11:24:55 -07:00
topjohnwu
7961be5cfa
Migrate prepare_modules to Rust
2025-08-05 11:24:55 -07:00
topjohnwu
bf4ed295da
Update cargo dependencies
2025-08-02 13:43:27 -07:00
topjohnwu
f99912b9db
Update libsystem_properties
2025-07-21 13:47:30 -07:00
5ec1cff
a54bdb54e4
Skip avb 1,0 verify if tail contains avb 2.0 header
...
This way, magiskboot will not print "unexpected ASN.1 DER tag: expected SEQUENCE, got APPLICATION [1] (primitive)".
2025-07-21 00:51:14 -07:00
topjohnwu
cd9851a1fe
Add regression test for #9179
2025-07-18 17:58:29 -07:00
Wang Han
9ca469898c
Use worker for replace feature
...
This fixes https://github.com/topjohnwu/Magisk/issues/9179 .
2025-07-18 16:57:20 -07:00
topjohnwu
9d7a14b335
Remove unnecessary return
2025-07-14 10:03:22 -07:00
Wang Han
62e29fee74
Treat bind mount failure same as C++ implementation
...
This fixes #9139 and #9174 .
2025-07-14 00:27:24 -07:00
topjohnwu
466e4bd4e1
Update cargo dependencies
2025-07-11 02:04:33 -07:00
topjohnwu
55c3ee3a6f
Move Zygisk code out of module.cpp
2025-07-07 13:43:11 -07:00
vvb2060
ff18cb8e70
su: support drop capabilities
2025-07-03 02:42:08 -07:00
topjohnwu
37a9724a54
Apply clippy fix
2025-07-02 21:20:14 -07:00
topjohnwu
d660401063
Treat magisk symlinks differently
2025-07-02 21:20:14 -07:00
topjohnwu
88541d6f49
Fix file attribute copy in module mounting logic
...
Due to various reasons, we cannot directly mount module files in /data
into the real paths. Instead we bind mount the module root directory and
remount this mirror with specific mount-point flags. Relevant to this
bug, the module mount is mounted as read-only, which means the file
attribute copy operation could fail in certain configurations.
The fix here is to always copy file attributes into writable locations,
so either in the tmpfs worker directory, or in the module directory
under /data.
A new test case is added to make sure this regression will no longer
happen again in the future.
Fix #9139
2025-07-02 19:23:46 -07:00
topjohnwu
6dfe9df9e2
Run cargo fmt
2025-07-02 19:23:46 -07:00
Wang Han
7b2d40987c
Refactor magisk bins injection logic
...
Magisk binary mounting logic is not very clear now. In this commit, it
is rewritten in a more robust way. Now it has following cases in mind:
1) Device has a su binary, magisk need to overlay it
2) Choose the PATH with least files to reduce bind mount
3) Filter path which is not suitable
2025-07-01 02:16:16 -07:00
Wang Han
3a37e8c9c5
Don't clone attributes for magisk symlinks
...
This avoids use existing attributes for su, which will obviously break
magisk functions.
2025-07-01 02:16:16 -07:00
Wang Han
810174ef73
Ignore set_context() error if magisktmp is /sbin
...
recreate_sbin() will bind mount original files in /sbin to tmpfs /sbin,
so we have no choice but just log here to let the loop continue.
2025-06-30 17:39:54 -07:00
Wang Han
39f2940bd1
Skip symlink in restore_tmpcon()
...
If magisktmp is /sbin, there may exist files which is symlink to files in
root dir. As root is RO, setcontext will fail and break iterating loop.
2025-06-16 11:09:33 -07:00
topjohnwu
1460317ebd
Cleanup C++ headers
2025-06-16 02:25:38 -07:00
topjohnwu
b36066bbcd
Run clippy fix
2025-06-10 16:34:38 -07:00
topjohnwu
65d1c5827c
Update dependencies
2025-06-10 16:33:06 -07:00
Wang Han
0b494ed7df
Avoid throwing error if chmod a symlink
...
It is possible that we want to clone attributes of a regular file to a
symlink. In this case, we don't need to error out if chmod fails. Just
skip it.
2025-06-06 17:08:34 -07:00
Wang Han
0e86d4dbcb
Fix file pointer leak on error path
2025-06-03 00:34:52 -07:00