Commit Graph

391 Commits

Author SHA1 Message Date
f97866a961 Close stub fd 2022-04-13 23:19:14 -07:00
e1987c42c4 Cleanup SELinux mock files 2022-04-13 23:18:55 -07:00
9de6e8846b Dump stub app to MAGISKTMP/stub.apk 2022-04-07 23:20:42 -07:00
01a1213463 /data/adb/magisk/magisk.apk no longer exists 2022-04-07 23:20:42 -07:00
448384af06 Guard su request IPC
Previously `read_string()` calls `std::string.resize()` with a int read from remote process. When I/O error occurs, -1 will be used for resizing the string, `std::bad_alloc` is thrown and since magisk is compiled with `-fno-exceptions`, it will crash the whole daemon process.

May fix topjohnwu#5681
2022-04-06 21:15:07 -07:00
efb3239cbd Drop package_name column 2022-03-28 02:05:09 -07:00
7e7ddeb9e2 Cleanup database migration code 2022-03-28 00:59:16 -07:00
7f1f0b9048 Proper support multiple modules adding same dir 2022-03-21 15:53:49 -07:00
dd5a3416bf Fix multiple modules adding the same subdirectory 2022-03-19 12:28:54 -07:00
fa8900be65 Use standalone magiskpolicy 2022-03-17 03:15:39 -07:00
563a587882 Initialize local variables
Fix #5542
2022-03-09 20:43:42 -08:00
548d70f30c Mount with original option
Fix #5481, close #5486
2022-03-01 20:09:59 -08:00
9968af0785 Move all permission check into daemon.cpp 2022-03-01 03:15:38 -08:00
be7586137c Reduce C++ wizardry 2022-03-01 03:15:38 -08:00
7999b66c3c Refactor daemon connection 2022-03-01 03:15:38 -08:00
c82a46c1ee Check property before switch mem cgroup 2022-02-28 23:27:23 -08:00
d021bca6ef Prevent app_process from setting umask
Fix #5435
2022-02-11 01:26:24 -08:00
d2c2456fbe Don't use getmntent_r from system's libc
Fix #5354

Co-authored-by: topjohnwu <topjohnwu@gmail.com>
2022-02-04 23:19:12 -08:00
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
fbe17dde03 Add flag for unloaded Zygisk modules 2022-01-21 05:37:47 -08:00
f443cbaa2b Revert "Always run non disabled module post-fs-data scripts"
This reverts commit 4dfb193d10.
2022-01-18 04:48:47 -08:00
bb7a74e4b4 Add Zygisk API getFlags() 2022-01-17 19:54:33 -08:00
76ddfeb93a Allow modifying denylist without enforcement 2022-01-15 23:46:22 -08:00
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
21d7db0959 Add new Zygisk API to get module dir 2022-01-14 03:10:02 -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
fef44bd24f Allow boot scripts to know Zygisk status 2021-11-20 13:05:15 -08:00
4dfb193d10 Always run non disabled module post-fs-data scripts 2021-11-16 21:29:13 -08:00
d4ac458d17 Ignore zygisk modules when zygisk is not enabled 2021-11-16 21:14:35 -08:00
8bd0c44e83 Replace module fd with memfd if possible 2021-10-28 00:26:18 -07:00
ea75a09f95 Make zygisk survive zygote restarts
Close #4777
2021-10-27 01:53:16 -07:00
49abfcafed Fix nullptr dereference when env abnormal 2021-10-26 00:40:00 -07:00
2e299b3814 Add an old cgroup v2 path
https://android-review.googlesource.com/c/platform/system/core/+/1324649
2021-10-25 20:54:19 -07:00
4b307cad2c Random minor changes 2021-10-23 22:20:07 -07:00
7496d51580 Make zygiskd ABI aware 2021-10-23 14:38:30 -07:00
8d0dc37ec0 Use SO_PEERSEC to get client secontext 2021-10-19 23:46:38 -07:00
fe41df87bb pthread_cond_signal might wake multiple threads
Close #4759
2021-10-19 21:32:37 -07:00
e184eb4a23 Fix UB of loading modules
- The lambda here infers its return type as `std::string`,
  and since `info` is `const`, the labmda copies `info.name`
  and returns a `std::string&&`. After captured by the
  `std::string_view`, the `std::string&&` return value
  deconstructs and makes `std::string_view` refers to a
  dangling pointer.
2021-10-17 04:38:56 -07:00
6f54c57647 Allow fork in thread pool 2021-10-17 04:24:25 -07:00
b75ec09998 Load Zygisk modules even if no magic mount is needed
Close #4767
2021-10-14 01:35:29 -07:00
c8ac6c07b0 Load Zygisk modules 2021-10-13 04:52:02 -07:00
f59309a445 Minor changes 2021-10-09 11:36:01 -07:00
36765caedc Fix thread pool implementation
Close #4759
2021-10-08 23:28:14 -07:00
ecd332c573 Close fd 2021-09-25 12:07:52 -07:00
73d36fdff0 Riru and its modules are not compatible with zygisk 2021-09-23 23:54:46 -07:00
d20517483e Prevent multiple mounts of devpts 2021-09-23 02:40:24 -07:00
61783ffc82 Prevent original libselinux.so to be unmounted
libselinux.so will be unmounted when magiskd starts. If magiskd restarts (like it died before boot completed), the files we want to unmount is the original files because the modified files is unmounted in previous start, which will causes many crashes due to missing libselinux.so.
2021-09-22 19:34:44 -07:00
f7c0e407ca Fix downgrade database 2021-09-20 05:50:34 -07:00
f1b6c9f4aa Refresh uid_map on package.xml change 2021-09-20 04:42:06 -07:00
0ab31ab0df Fix log writer 2021-09-19 13:41:45 -07:00