Commit Graph
348 Commits
Author SHA1 Message Date
topjohnwu f10ad93c4e Move more code of daemon_entry into Rust 2025-09-13 01:21:33 -07:00
topjohnwu f143b5df15 Do not mount directories as mirror
Mounting real directories into worker will cause init to start tracking
the mount point through dev.mnt. This causes issues, so we are forced
to recursively reconstruct the mirror directory structure from scratch.

Fix #9316
2025-09-12 22:01:08 -07:00
topjohnwu 71213cc6f4 Fix path tracking in module.rs 2025-09-12 22:01:08 -07:00
topjohnwu e2a1774e5b Make logging.rs use nix 2025-09-11 01:17:34 -07:00
topjohnwu 0222527a1e Use bitflags macro 2025-09-11 01:17:34 -07:00
topjohnwu 312bfe1bab Do not leak base::ffi to external crates 2025-09-11 01:17:34 -07:00
rikka cfc2bcb665 Fix zygisk native bridge library name concatenation order 2025-09-11 01:16:54 -07:00
topjohnwu 111136733a Migrate away from unsafe set_len of Utf8CStr 2025-09-09 22:19:05 -07:00
topjohnwu c8caaa98f5 Enable mount for nix 2025-09-09 20:17:09 -07:00
topjohnwu 8d28f10a3f Enable zerocopy for nix 2025-09-09 12:04:46 -07:00
topjohnwu 177a456d8b Enable term for nix 2025-09-09 12:04:31 -07:00
topjohnwu ef4e230258 Use nix for libc functions 2025-09-08 23:59:29 -07:00
topjohnwu 17082af438 Simplify OsError 2025-09-08 11:25:20 -07:00
topjohnwu 1df5b34175 Stop differentiate Error vs ErrorCxx 2025-09-08 11:25:18 -07:00
topjohnwu ea5fe7525d Simplify LibcReturn 2025-09-08 10:55:57 -07:00
topjohnwu fb0c4ea838 Fallback to userspace copy if splice failed
Fix #9032
2025-09-03 16:10:18 -07:00
topjohnwu bd657c354c Reduce FFI across C++/Rust 2025-09-02 22:06:08 -07:00
topjohnwu 653730d75e Make cxx binding generate less code 2025-08-29 01:44:06 -07:00
topjohnwu 484d53ef7e Update to ONDK r29.2 2025-08-28 16:15:59 -07:00
topjohnwu c4e2985677 Migrate resetprop to Rust 2025-08-27 22:48:48 -07:00
topjohnwu 42d9f87bc9 Cleanup resetprop code 2025-08-27 22:48:48 -07:00
topjohnwu 2e4fa6864c Make Utf8CStr a first class citizen in C++ codebase
Utf8CStr is in many cases a better string view class than
std::string_view, because it provides "view" access to a string buffer
that is guaranteed to be null terminated. It also has the additional
benefit of being UTF-8 verified and can seemlessly cross FFI boundaries.

We would want to start use more Utf8CStr in our existing C++ codebase.
2025-08-27 22:48:48 -07:00
topjohnwu b861671391 Cleanup libbase 2025-08-25 01:31:47 -07:00
topjohnwu e91fc75d86 Consolidate for_each implementation into Rust 2025-08-25 01:31: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 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 f99912b9db Update libsystem_properties 2025-07-21 13:47:30 -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 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