Commit Graph

1153 Commits

Author SHA1 Message Date
LoveSy
e9f562a8b7 Fix abuse of fdopendir
After `fdopendir`, the fd is no longer usable. Should dup and
make use of RAII

Co-authored-by: 残页 <31466456+canyie@users.noreply.github.com>
2022-02-04 22:54:34 -08:00
残页
79620c97d1
Invalidate Samsung's persist.sys.zygote.early
Samsung FDE devices with the "persist.sys.zygote.early=true" property will cause Zygote to start before post-fs-data. According to Magisk's document, the post-fs-data phase should always happen before Zygote is started. Features assuming this behavior (like Zygisk and modules that need to control zygote) will not work. To avoid breaking existing modules, we simply invalidate this property to prevent this non-standard behavior from happening

Fix #5299, fix #5328, fix #5308

Co-authored-by: LoveSy <shana@zju.edu.cn>
2022-02-03 00:46:52 -08:00
topjohnwu
7f65f7d3ca Separate libc.a hacks into its own component 2022-01-31 02:09:08 -08:00
topjohnwu
9fa096c6f4 Add runtime FORTIFY support
Gingerbread libc.a missing symbols
2022-01-31 01:49:37 -08:00
LoveSy
70415a396a Do not filter uid == 1000 for process info 2022-01-30 08:25:24 -08:00
topjohnwu
3bf47a6838 Update selinux 2022-01-30 08:18:04 -08:00
topjohnwu
d3d28f0623 Update to NDK r23b
Credits: @yujincheng08

Close #5193
2022-01-30 07:11:51 -08:00
topjohnwu
06531f6d06 Add annotations to suppress warnings 2022-01-25 04:16:14 -08:00
topjohnwu
2b303a7e23 Add a missing busybox patch back
Hopefully, fix #4174
2022-01-25 03:37:59 -08:00
topjohnwu
45483fde74 Update CLI usages 2022-01-25 02:04:15 -08:00
topjohnwu
2fe3082518 Update busybox 2022-01-24 23:20:36 -08:00
topjohnwu
5a889d28c8 Pick a more reasonable zopfli config
Close #4980
2022-01-24 23:07:49 -08:00
topjohnwu
c6dcff0ae7 Minor dynamic_bitset changes 2022-01-24 22:30:19 -08:00
LoveSy
02dd962601 Don't load zygisk module for magisk app 2022-01-24 03:05:12 -08:00
topjohnwu
cbe97cdfde Fix dynamic_bitset implementation 2022-01-23 04:39:00 -08:00
topjohnwu
407dfc7547 Always write 0 to fd 2022-01-23 04:19:07 -08:00
topjohnwu
fbe17dde03 Add flag for unloaded Zygisk modules 2022-01-21 05:37:47 -08:00
John Wu
c826318da4 Update CLI usage text 2022-01-20 01:59:01 -08:00
LoveSy
6582a4abd9 Make magiskpolicy supports multiple --apply 2022-01-20 01:59:01 -08:00
topjohnwu
195d885887 Reduce log spamming 2022-01-20 00:18:46 -08:00
topjohnwu
519bd2f30f Disable AVD hacks by default 2022-01-19 20:28:01 -08:00
topjohnwu
20ef724fad Add new build command avd_patch 2022-01-19 05:12:11 -08:00
vvb2060
f443cbaa2b Revert "Always run non disabled module post-fs-data scripts"
This reverts commit 4dfb193d10.
2022-01-18 04:48:47 -08:00
topjohnwu
bb7a74e4b4 Add Zygisk API getFlags() 2022-01-17 19:54:33 -08:00
topjohnwu
76ddfeb93a Allow modifying denylist without enforcement 2022-01-15 23:46:22 -08:00
LoveSy
c38b826abf Skip overlayfs for post-fs-data mount
adb remount will introduce overlayfs for /system and /vendor, we should
skip mounting as overlayfs. This also helps us support overlayfs Magisk
later.
2022-01-14 03:42:37 -08:00
topjohnwu
21d7db0959 Add new Zygisk API to get module dir 2022-01-14 03:10:02 -08:00
LoveSy
b2cd24ed1b Fix an UB when cil compile error 2022-01-11 03:01:27 -08:00
topjohnwu
f4926cb822 Small refactoring 2022-01-02 16:09:03 -08:00
topjohnwu
1e77e0862a Separate fstab finding to its own function 2022-01-02 15:49:12 -08:00
topjohnwu
8c696cb8ca Minor code refactoring 2021-12-28 23:37:06 -08:00
LoveSy
62ef8ade8f
Skip loading Magisk when detecting DSU
Fix #4402

Co-authored-by: topjohnwu <topjohnwu@gmail.com>
2021-12-28 21:04:09 -08:00
LoveSy
3d88dd3123 Update dtc to fix a UB
See https://github.com/dgibson/dtc/pull/65
2021-12-28 17:18:32 -08:00
残页
880b348ce6 Add an old cgroup path
Fix topjohnwu#5125
cgroup root path might be mem cgroup instead of acct, especially on low-ram devices.
bc131c3244%5E%21/#F0
2021-12-28 17:12:15 -08:00
LoveSy
19182ffddf If dt fstab contains error, fallback to default fstab
See https://cs.android.com/android/platform/superproject/+/master:system/core/init/first_stage_mount.cpp;drc=master;l=155

From the source of `FirstStageMount`, dt fstab can fail gracefully and
if any error occurs it will fall back to default fstab. Magisk now
replaces the default fstab and dt fstab unconditionally, bringing potential
errors to the default fstab and causing init fails to load partitions.
2021-12-28 17:10:52 -08:00
topjohnwu
f4ed6274a4 Invert vbmeta header patching config
vbmeta header should not be patched in most cases
2021-12-14 04:52:25 -08:00
LoveSy
56eb1a1cf9 Load fstab from system/etc
Caused by this commit: e98afa2687

Fix #5057
2021-12-14 03:51:55 -08:00
LoveSy
a7c156a9e3
Further fix oplus.fstab support
* Further fix `oplus.fstab` support

In some oneplus devices, `oplus.fstab` does exists but `init` never
loaded it and those entries in `oplus.fstab` are written directly to
`fstab.qcom`. Previous implementation will introduce duplicate entries
to `fstab.qcom` and brick the device. This commit filters those entries
from `oplus.fstab` that are already in `fstab.qcom` and further filters
duplicated entries in `oplus.fstab` (keep only the last entry).

Fix #5016

* Fix UB

Since we moved entry, we need to explicitly copy its member.
For c++23 we can use `auto{}`.
2021-12-14 03:40:23 -08:00
残页
b5d80a88d1 Only care about mount namespace isolating 2021-12-14 03:08:55 -08:00
LoveSy
87c2f6ad14
xhook_clear after xhook_refresh 2021-12-14 03:06:57 -08:00
topjohnwu
e097c097fe Rename persist_properties.cpp -> persist.cpp 2021-11-30 01:58:31 -08:00
topjohnwu
1443a5b175 Use mmap_data more widely 2021-11-30 01:50:55 -08:00
topjohnwu
2d82ad93dd Macro -> template 2021-11-29 19:56:37 -08:00
topjohnwu
0a28dfe1e2 AVB blobs expect to be 4096-byte aligned 2021-11-28 13:21:05 -08:00
topjohnwu
228570640e Introduce KEEPVBMETAFLAG env variable
Close #4447, close #4906, close #4901, close #4964
2021-11-23 22:14:12 -08:00
topjohnwu
65a79610aa Fix crash and warnings 2021-11-23 18:46:06 -08:00
topjohnwu
24984ea4f2 Optimize stream for full-file writes 2021-11-23 18:08:14 -08:00
topjohnwu
048b2af0fc Improve zopfli encoder
Write in chunks for CLI compression
2021-11-23 16:50:08 -08:00
topjohnwu
449989ddd9 Always use zopfli for zImage compression 2021-11-23 14:24:05 -08:00
topjohnwu
01ebe5724a Cleanup zImage parsing code 2021-11-23 13:39:15 -08:00