Commit Graph

75 Commits

Author SHA1 Message Date
topjohnwu 76ddfeb93a Allow modifying denylist without enforcement 2022-01-15 23:46:22 -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.
https://android.googlesource.com/platform/system/core/+/bc131c3244a6aa4961092ba08285f9d0435a8882%5E%21/#F0
2021-12-28 17:12:15 -08:00
topjohnwu ea75a09f95 Make zygisk survive zygote restarts
Close #4777
2021-10-27 01:53:16 -07:00
vvb2060 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
topjohnwu 8d0dc37ec0 Use SO_PEERSEC to get client secontext 2021-10-19 23:46:38 -07:00
topjohnwu 6f54c57647 Allow fork in thread pool 2021-10-17 04:24:25 -07:00
vvb2060 ecd332c573 Close fd 2021-09-25 12:07:52 -07:00
vvb2060 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
topjohnwu 3fb72a4d20 Support polling on multiple fds 2021-09-18 14:40:12 -07:00
topjohnwu 65b0ea792e MagiskHide is no more 2021-09-12 12:40:34 -07:00
topjohnwu de2306bd12 Proper incremental builds
Auto generate flag.h for precise rebuilding
2021-09-07 19:35:28 -07:00
vvb2060 f324252681 Use isolated devpts if kernel support
kernel version >= 4.7 or CONFIG_DEVPTS_MULTIPLE_INSTANCES=y
2021-08-29 02:45:49 -07:00
topjohnwu 4771c2810b Significantly better AVD support 2021-08-26 03:09:56 -07:00
topjohnwu 0cd99712fa Implement cached thread pool 2021-08-24 02:39:54 -07:00
topjohnwu b591af7803 Minor bug fixes 2021-08-22 03:26:48 -07:00
topjohnwu 9b3efffba9 Use magiskd to setup files 2021-08-18 03:44:32 -07:00
topjohnwu 0d977b54f7 Revise logging code 2021-08-12 03:26:54 -07:00
topjohnwu 20860da4b4 Cleaner daemon handlers 2021-08-11 22:57:08 -07:00
topjohnwu 82f8948fd4 Separate setting log functions and starting log daemon 2021-03-13 17:50:48 -08:00
Shaka Huang b9cdc755d1 Returned fds[0] in socketpair() might be STDOUT
* There will be garbage output when executing `su` (#4016)
* Failed to check root status and showing N/A in status (#4005)

Signed-off-by: Shaka Huang <shakalaca@gmail.com>
2021-03-13 17:50:48 -08:00
topjohnwu a6f81c66e5 Bypass stdio 2021-03-13 16:17:28 -08:00
topjohnwu 43c1105d62 Use dedicated thread for writing logfile 2021-03-09 02:40:12 -08:00
vvb2060 b693d13b93 Proper implementation of cgroup migration
https://www.kernel.org/doc/Documentation/admin-guide/cgroup-v1/cgroups.rst
https://www.kernel.org/doc/Documentation/admin-guide/cgroup-v2.rst
2021-03-07 01:55:19 -08:00
topjohnwu 39982d57ef Fix logging implementation
- Block signals in logging routine (fix #3976)
- Prevent possible deadlock after fork (stdio locks internally)
  by creating a new FILE pointer per logging call (thread/stack local)
2021-03-06 13:55:30 -08:00
vvb2060 ac8372dd26 Add cgroup2 path
https://android-review.googlesource.com/c/platform/system/core/+/1585101
2021-02-26 21:36:58 -08:00
topjohnwu f5c2d72429 Also log pid and tid 2021-01-16 16:10:47 -08:00
topjohnwu 9a28dd4f6e Implement MagiskHide through code injection 2021-01-12 03:28:00 -08:00
topjohnwu eb21c8b42e Code cleanups 2021-01-11 02:19:10 -08:00
topjohnwu 4060c2107c Add preliminary zygote code injection support
Prototyping the injection setup and a clean "self unloading" mechanism.
2021-01-06 22:21:17 -08:00
topjohnwu f9bde347bc Convert indentation to spaces
The tab war is lost
2020-12-30 22:11:24 -08:00
topjohnwu 086059ec30 Make sure boot stages are mutually exclusive 2020-12-15 03:40:37 -08:00
topjohnwu c62dfc1bcc Make logging less error prone 2020-12-06 23:09:24 -08:00
topjohnwu dead74801d Setup log file when manually starting daemon 2020-12-04 01:07:47 -08:00
topjohnwu ab207a1bb3 va_list cannot be reused on x86 2020-12-03 20:53:19 -08:00
topjohnwu f152e8c33d Directly log to log file 2020-12-03 20:15:18 -08:00
topjohnwu d625beb7f3 Update --remove-modules implementation 2020-10-11 18:30:03 -07:00
topjohnwu 97b72a5941 Revert to old SElinux rules on pre 8.0 devices
Fix #2910
2020-07-06 01:13:50 -07:00
topjohnwu 2f824f59dc Better logging system
Use C++ magic to strip out debug logs at compile time
2020-06-01 04:15:37 -07:00
topjohnwu c3e045e367 Use daemon state to determine late prop hiding 2020-05-18 05:21:47 -07:00
topjohnwu 501d3e6c32 Maintain global daemon status 2020-05-18 05:18:49 -07:00
topjohnwu 122b4d66b6 Move Android logging out of libutils 2020-05-10 00:48:41 -07:00
topjohnwu a5d7c41d20 Support Safe Mode detection
When detecting device is booting as Safe Mode, disable all modules and
MagiskHide and skip all operations. The only thing that'll be available
in this state is root (Magisk Manager will also be disabled by system).

Since the next normal boot will also have all modules disabled, this can
be used to rescue a device in the case when a rogue module causes
bootloop and no custom recovery is available (or recoveries without
the ability to decrypt data).
2020-05-08 00:45:11 -07:00
topjohnwu 5fd574a14f Fix --remove-modules command 2020-04-30 01:27:48 -07:00
topjohnwu 43029f37b1 Cleanup our tracks 2020-04-19 04:57:18 -07:00
topjohnwu e0a281583d Preparation for dynamic tmpfs path 2020-04-12 05:34:56 -07:00
topjohnwu ba7cb47383 Make version reporting consistent 2020-03-23 01:17:13 -07:00
topjohnwu a0998009c1 Small native code reorganization 2020-03-09 01:50:30 -07:00
topjohnwu ebdd6ec40c Fallback to getprop to get SDK_INT
Close #2274, close #2279
2020-02-03 12:58:59 +08:00
topjohnwu af060b3132 General QoL changes 2019-12-13 00:37:06 -05:00