51 Commits

Author SHA1 Message Date
topjohnwu
da43ac89a0 Allow all domains to access tmpfs files
Fix #8457
2024-11-30 23:21:33 -08:00
残页
5b29fefc65 Replace LOGE with LOGW so the process don't abort
Co-authored-by: 南宫雪珊 <vvb2060@gmail.com>
2024-09-25 11:59:58 -07:00
残页
16a168535d Check sepolicy database version in add_xperm_rule
Fix #8344
2024-09-25 11:59:58 -07:00
LoveSy
9cc50b20d8 Correctly handle comments in sepolicy.rule 2024-07-24 19:02:25 -07:00
LoveSy
69181a6b72 Fix wrong sepolicy rule 2024-07-08 12:09:45 -07:00
Wang Han
b11b81122a Tighten rules for tmpfs file
Before magiskd is executed, all files in magisk tmpfs still shares
tmpfs label. This commit tightens the rule to only allow init, zygote
and shell to access magisk tmpfs files. Zygotes rules is needed
because lower Android versions don't have rule for zygote itself
using memfd even memfd is supported in kernel.
2024-07-08 12:06:49 -07:00
LoveSy
652a26d5d9 Fix comment of sepolicy 2024-04-03 21:03:41 -07:00
topjohnwu
9a008c17ba Optimize for binary size 2024-03-22 16:53:44 -07:00
topjohnwu
08dbf728a4 Allow platform_app to access MagiskSU 2024-03-22 16:53:44 -07:00
topjohnwu
4670f762d3 Disable debug only features 2024-03-22 16:53:44 -07:00
topjohnwu
efa49567fa Fix parsing logic for term and sterm 2024-03-21 18:17:28 -07:00
topjohnwu
0ffc4527a7 Better error reporting 2024-03-21 15:10:34 -07:00
topjohnwu
dd9d43be96 Move sepolicy parsing error message into Rust 2024-03-21 14:07:28 -07:00
topjohnwu
865fca71a5 Optimize sepolicy rules
Close #7916

Co-authored-by: vvb2060 <vvb2060@gmail.com>
2024-03-21 01:51:35 -07:00
topjohnwu
6b4baa3bcd Change a little parsing handling 2024-03-21 00:04:09 -07:00
topjohnwu
a9ee2d7d18 Fix xperm parsing logic 2024-03-20 23:13:54 -07:00
topjohnwu
d654b9cb97 Several code cleanups in sepolicy 2024-03-20 23:09:22 -07:00
LoveSy
4d2921e742 Rewrite sepolicy statement parsing in Rust 2024-03-20 10:12:23 -07:00
LoveSy
2290ddeb89 Fix segfault when sepolicy.rule has empty line 2024-03-02 06:15:45 -08:00
topjohnwu
24e46a5971 Build magiskboot with crt0 2024-02-29 02:36:05 -08:00
topjohnwu
625a1d6f44 Remove seek support from streams 2024-02-28 11:07:53 -08:00
topjohnwu
66f49dfab5 Remove unnecessary lock usage 2024-02-24 04:20:28 -08:00
topjohnwu
b7505c3c9c Remove fopen usage in magiskinit 2024-02-24 00:45:07 -08:00
topjohnwu
65207f96c8 Create custom cxx binding to Utf8CStr 2023-12-26 23:10:55 +08:00
Wang Han
1ef3f6e13b Remove useless rule for prctl PR_SET_MM
* There is no use-case for it now.
2023-12-22 00:36:06 +08:00
topjohnwu
65c18f9c09 Restructure project files 2023-11-08 01:46:02 -08:00
topjohnwu
ac5ceb18c8 Guard log FIFO with SELinux 2023-11-04 23:59:11 -07:00
topjohnwu
66788dc58c Cleanup SELinux support 2023-10-16 17:38:44 -07:00
topjohnwu
9aa466c773 Fix genfscon and filename_trans
Fix #7329
2023-09-12 21:31:31 -07:00
topjohnwu
41226c12b8 Update to ONDK r25.7 2023-08-15 17:10:20 -07:00
topjohnwu
17ba5cba3e Print permissive rules 2023-08-02 09:11:22 -07:00
topjohnwu
c83e141a1c Support dumping sepolicy rules 2023-08-01 18:03:54 -07:00
topjohnwu
6089cc36de Update xperm parsing 2023-07-31 09:28:27 -07:00
Andrew Gunnerson
b191a14a23 magiskpolicy: Fix old xperms being cleared when adding new xperms
This commit updates sepol_impl::add_xperm_rule() so that it loads the
current xperm bits from the existing avtab entry before setting or
clearing xperm bits. This fixes new allowxperm rules causing old xperm
rules within the same xperm specified/driver to be removed.

Fixes: #7176

Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-07-24 23:52:28 -07:00
topjohnwu
4ee4cbada6 Standardize logging and error handling
- Introduce new types: LoggedResult and LoggedError
- Introduce new extension methods to log and add additional msgs
- Never exit when logging error messages in Rust (all errors should be
  handled by using Result and Rust's error propagation)
- Remove all usages of anyhow as it doesn't fit Magisk's use cases
2023-06-29 17:14:53 -07:00
LoveSy
c1038ac6f9 Remove permissve update_engine 2023-06-10 13:17:37 -07:00
topjohnwu
ee4dad7a13 Bridge C++ bytes with Rust &[u8] 2023-06-07 16:49:40 -07:00
topjohnwu
2a654e5d7f Improve byte_data const correctness 2023-06-03 03:16:03 -07:00
topjohnwu
f2846694e1 Cleanup some code 2023-05-28 23:50:52 -07:00
topjohnwu
659b9c6fee Support extracting any partition from payload.bin 2023-05-26 13:36:47 -07:00
topjohnwu
18d0cedbe2 Parse rule files with Rust 2023-05-24 19:11:56 -07:00
LoveSy
f95478f1f1 Truncate file only if needed 2023-05-22 00:51:42 -07:00
topjohnwu
a5768e02ea Cleanup byte_channel implementation 2023-05-20 14:19:40 -07:00
topjohnwu
57bd450798 Split input and output streams 2023-05-19 04:19:43 -07:00
vvb2060
bc94ea4334 Update SELinux policy 2023-05-06 00:04:11 -07:00
LoveSy
dba5020e4f Refactor magiskrc 2023-03-22 17:53:15 -07:00
LoveSy
1a1646795f Support untrusted_app_32 2023-03-09 02:17:30 -08:00
南宫雪珊
3726eb6032
Deny init relabel to adb_data_file
Co-authored-by: 残页 <a1364259@163.com>
Co-authored-by: LoveSy <shana@zju.edu.cn>
2023-03-02 02:20:38 -08:00
topjohnwu
4c0f72f68f Move part of libbase to Rust 2022-08-08 22:53:37 -07:00
canyie
1d0b873950 Fix sepolicy attribute rule parsing
Fix #6166
2022-08-07 03:35:50 -07:00