topjohnwu
9a28dd4f6e
Implement MagiskHide through code injection
2021-01-12 03:28:00 -08:00
topjohnwu
d2acd59ea8
Minor code refactoring
2021-01-12 00:07:48 -08:00
topjohnwu
eb21c8b42e
Code cleanups
2021-01-11 02:19:10 -08:00
topjohnwu
70d67728fd
Add global toggle for ptrace monitor
2021-01-10 19:27:54 -08:00
topjohnwu
e546884b08
Remove isolated process handling in ptrace
...
Impossible to achieve only through ptrace
2021-01-10 17:18:42 -08:00
topjohnwu
b36e6d987d
Reorganize MagiskHide code
...
Prepare for zygote injection hiding
2021-01-10 17:11:00 -08:00
topjohnwu
53c3dd5e8b
Auto track JNI method hooks
2021-01-10 05:07:17 -08:00
topjohnwu
da723b207a
Allow 3rd party code to load pre-specializing
...
Magisk's policy is to never allow 3rd party code to be loaded in the
zygote daemon process so we have 100% control over injection and hiding.
However, this makes it impossible for 3rd party modules to run anything
before process specialization, which includes the ability to modify the
arguments being sent to these original nativeForkAndXXX methods.
The trick here is to fork before calling the original nativeForkAndXXX
methods, and hook `fork` in libandroid_runtime.so to skip the next
invocation; basically, we're moving the responsibility of process
forking to our own hands.
2021-01-10 01:25:30 -08:00
topjohnwu
e050f77198
Don't hook SystemProperties#set
...
Doesn't seem necessary
2021-01-09 20:39:59 -08:00
topjohnwu
540b4b7ea9
Update pre/post hooks implementation
2021-01-09 17:41:25 -08:00
topjohnwu
bbef22daf7
More macro magic to automate more code
2021-01-09 04:28:26 -08:00
topjohnwu
9ed110c91b
Add JNI hooks to critical methods
2021-01-08 05:25:44 -08:00
topjohnwu
a30d510eb1
Use xHook to hook functions in PLT
2021-01-08 00:53:24 -08:00
topjohnwu
ef98eaed8f
Proper injection entry and unloading
2021-01-06 23:59:05 -08:00
topjohnwu
2a257f327c
Sanitize /proc/PID/environ
2021-01-06 23:41:37 -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
cd23d27048
Fix remote_write implementation
2021-01-06 21:56:29 -08:00
topjohnwu
18b86e4fd2
Update Android.mk for test binary
...
Make Android Studio happy
2021-01-05 00:01:02 -08:00
topjohnwu
5f2e22a259
Support remote function call with ptrace
...
End up not used for anything, but keep it for good
2021-01-02 21:29:45 -08:00
topjohnwu
4e97b18977
Move libsystemproperties to external
2020-12-31 15:06:19 -08:00
topjohnwu
f9bde347bc
Convert indentation to spaces
...
The tab war is lost
2020-12-30 22:11:24 -08:00
Billy Laws
947a7d6a2f
Support rootwait cmdline parameter on legacy SAR
...
On devices where the primary storage is slow to probe it makes sense to
wait forever for the system partition to mount, this emulates the
kernel's behaviour when waiting for rootfs on SAR if the rootwait
parameter is supplied.
This issue was encountered with some SD cards on the Nintendo Switch.
2020-12-30 16:43:28 -08:00
topjohnwu
79fa0d3a90
Hide selection improvements
2020-12-30 16:40:22 -08:00
topjohnwu
8e61080a4a
Preparation for hiding isolated processes
2020-12-30 15:55:53 -08:00
topjohnwu
db4f78d463
Unblock signals before executing commands
2020-12-27 15:05:39 -08:00
vvb2060
c5b452f369
Get boot config properly
...
https://android.googlesource.com/platform/system/core/+/refs/tags/android-11.0.0_r16/fs_mgr/fs_mgr_boot_config.cpp#93
2020-12-19 15:55:33 -08:00
topjohnwu
eee7f097e3
Make post-fs-data scripts block at most 35 secs
2020-12-17 16:54:53 -08:00
topjohnwu
086059ec30
Make sure boot stages are mutually exclusive
2020-12-15 03:40:37 -08:00
topjohnwu
7ff22c68c7
Only try to install APK when no manager is active
2020-12-09 02:15:16 -08:00
topjohnwu
0c28b23224
Fix install_module command
2020-12-09 00:37:15 -08:00
topjohnwu
c62dfc1bcc
Make logging less error prone
2020-12-06 23:09:24 -08:00
topjohnwu
aabe2696fe
Cleanup implementations
2020-12-06 03:07:47 -08:00
topjohnwu
ae0d605310
Make sure patch_rootdir does not cause crashes
2020-12-06 02:19:57 -08:00
topjohnwu
2a694596b5
Better error handling and logging
2020-12-05 10:23:49 -08:00
topjohnwu
ff0a76606e
Detect 2SI after system_root mount on legacy SAR
2020-12-04 03:06:21 -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
797ba4fbf4
Make sure all logging ends with newline
2020-12-02 00:55:22 -08:00
topjohnwu
552ec1eb35
Header v3 does not have name entry
2020-11-20 22:52:09 -08:00
topjohnwu
0064b01ae0
Trim out \r from string
...
Fix #3490
2020-11-15 06:30:29 -08:00
topjohnwu
e0afbb647b
Minor changes
2020-11-13 02:31:54 -08:00
topjohnwu
f9c7a4c933
Redirect /data/adb/magisk/busybox
...
Workaround some stupid Samsung kernel restrictions
2020-11-11 02:26:07 -08:00
topjohnwu
2b759b84b0
Properly reset string
2020-11-09 21:17:21 -08:00
topjohnwu
1e45c63ea5
Scan for zygote periodically
...
Fix #3417
2020-11-08 03:44:43 -08:00
topjohnwu
b14a260827
Offset pid_set by 1
...
PID starts at 1, not 0
2020-11-08 02:12:35 -08:00
topjohnwu
ade1597e03
Support hiding apps not installed in main user
...
Fix #2181 , close #1840
2020-11-08 01:53:18 -08:00
topjohnwu
afebe734b8
Fix several things regarding scripting
2020-11-07 14:36:13 -08:00
topjohnwu
e21a78164e
Properly handle factory resets
...
Close #3345
2020-11-04 04:50:04 -08:00
topjohnwu
1e0f96d0fd
Prefer platform implementation over internal
2020-11-04 04:42:02 -08:00