57 Commits

Author SHA1 Message Date
topjohnwu
f3fef7bfe4 Make FsPath a trait 2025-04-22 03:21:00 -07:00
topjohnwu
c34c7838bb Cleanup cstr implementation 2025-04-22 03:21:00 -07:00
topjohnwu
7bd901273c Provide richer error messages
Make sure most syscall/libc calls results are mapped to OsResult
that can produce more detailed error messages.
2025-04-15 00:18:48 -07:00
topjohnwu
d4a0286e13 Migrate magiskinit selinux.cpp to Rust 2025-04-08 02:33:52 -07:00
topjohnwu
c09a792958 Reorganize magiskinit code 2025-03-24 17:26:03 -07:00
topjohnwu
6ff82c4e86 Introduce FsPathFollow
Make sure all operations of FsPath do not follow symlinks, and provide
a way to explicitly switch over to a set of operations that DO follow
symlinks by FsPath::follow_link.
2025-03-07 15:51:51 -08:00
topjohnwu
c90e73ccec Migration to Edition 2024 2025-03-07 02:35:25 -08:00
vvb2060
e8958c6b5c get_secontext: ignore ENODATA 2025-03-06 20:03:36 -08:00
topjohnwu
b6b34f7612 Fix overlay.d context preservation 2025-02-27 01:57:25 -08:00
topjohnwu
363410e1c0 Introduce cstr_buf helper functions 2025-02-17 11:32:21 -08:00
topjohnwu
fc2ef21660 Introduce path! macro for FsPath 2025-02-17 01:46:19 -08:00
topjohnwu
dcf027884d Update FsPathBuf 2025-02-15 18:27:45 -08:00
topjohnwu
584f3820fe Make all Utf8CStrWrite Utf8CStrBuf 2025-02-15 18:27:45 -08:00
topjohnwu
a48a9c858a Migrate zygisk handler to Rust 2025-01-31 02:52:27 +08:00
topjohnwu
4dcd733ddd Minor code cleanup 2025-01-31 02:52:27 +08:00
topjohnwu
a1b2830c06 Address clippy warnings 2025-01-11 00:11:48 +08:00
topjohnwu
ee6810f417 Rewrite magisk logging implementation 2025-01-11 00:11:48 +08:00
topjohnwu
2654382c43 Address clippy warnings 2024-12-09 18:26:39 -08:00
topjohnwu
5ac7dc0b37 Support vendor boot unpack/repack
Fix #6460, close #6620
2024-07-30 04:00:12 -07:00
topjohnwu
7c88484d64 Fix #7988 2024-04-16 19:45:01 -07:00
topjohnwu
b22b6a4204 Refactor cpio 2024-04-10 22:46:21 -07:00
topjohnwu
2a3d34c812 Fix mkdirs 2024-04-10 22:36:47 -07:00
topjohnwu
2e4440b702 Support 32-bit magiskboot 2024-04-09 19:34:14 -07:00
topjohnwu
715284b70d Reorganize code 2024-02-27 18:14:30 -08:00
topjohnwu
4b8a0388e7 Make SELinux support a feature 2023-10-17 13:29:15 -07:00
topjohnwu
eda8c70a80 Borrow value instead of moving in FsPath::from()
When accepting a value of AsRef<Utf8CStr> in FsPath::from(), the
existing code will move a value of Utf8CStrBufArr, creating a reference
that lives longer than the borrowing value, causing undefined behavior.

The issue is only visible on release builds, as more advanced
optimizations will be more aggressive re-using the stack of variables
that no longer lives.

Fix #7408
2023-10-11 23:48:54 -07:00
topjohnwu
6e7a995716 Introduce UtfCString 2023-09-27 15:21:24 -07:00
topjohnwu
a55d570213 Move more I/O operations into Rust 2023-09-27 02:28:43 -07:00
topjohnwu
8e1a91509c Remove readlink_unsafe 2023-09-19 00:06:21 -07:00
LoveSy
5fbd3e5c65 Fix buf len update of read_link to Utf8CStrBuf 2023-09-18 22:31:12 -07:00
topjohnwu
dda8cc85c9 Use bytemuck 2023-09-14 13:10:09 -07:00
topjohnwu
6a59939d9a Remove for_all_file 2023-09-13 18:09:16 -07:00
topjohnwu
89aee6ffa7 Add more to the Utf8CStr family
Better C strings with path operations
2023-09-12 17:35:01 -07:00
LoveSy
8d81bd0e33 resetprop: replace nanopb with quick-protobuf for persist 2023-09-05 22:20:57 -07:00
topjohnwu
e8e8afa6c2 Properly handle visibility 2023-07-06 11:12:27 -07:00
LoveSy
a470ee6f93 Fix mmap block device 2023-06-30 01:06:51 -07:00
topjohnwu
2359cfc480 Small refactor 2023-06-20 00:21:51 -07:00
LoveSy
53257b6ea1 Fix find_apk_path 2023-06-15 04:09:45 -07:00
topjohnwu
9d6f6764cb Use Metadata instead of direct stat syscall 2023-06-12 14:58:13 -07:00
topjohnwu
cb3ab63815 Replace all CStr usage to Utf8CStr 2023-06-12 13:57:15 -07:00
topjohnwu
caae932117 Remove unnecessary lifetime markers 2023-06-12 13:56:20 -07:00
LoveSy
e9cf27eb5a Fix map_file 2023-06-12 13:55:58 -07:00
topjohnwu
23c1f0111b Improve Rust implementation
- Move mmap_file implementation into Rust
- Introduce Utf8CStr as the better c-string type to use
2023-06-12 02:40:50 -07:00
topjohnwu
d1621845b8 Fix typo 2023-06-10 01:50:18 -07:00
topjohnwu
40f25f4d56 Introduce directory traversal 2023-06-09 02:00:37 -07:00
topjohnwu
9ea9f01933 Resolve clippy errors and warnings 2023-05-31 01:08:33 -07:00
topjohnwu
5b8b48ccc1 Properly support streamable input 2023-05-26 14:07:11 -07:00
topjohnwu
18d0cedbe2 Parse rule files with Rust 2023-05-24 19:11:56 -07:00
topjohnwu
7b5ff99cd1 Reorganize code 2023-05-04 21:37:08 -07:00
topjohnwu
b136aba1e2 Implement magiskinit logging in Rust 2023-05-02 16:49:43 -07:00