Commit Graph

79 Commits

Author SHA1 Message Date
3798d50457 Kill processes with SIGKILL rather than SIGTERM 2021-05-04 22:14:46 -07:00
f4ac7c8e7c Ignore validating class name of isolated process name
Fix #4176

Co-authored-by: topjohnwu <topjohnwu@gmail.com>
2021-04-15 23:08:51 -07:00
01b985eded Remove more pre SDK 21 stuffs 2021-04-09 21:29:42 -07:00
8ddab84745 Don't auto hide microG
close #3559
2021-03-24 04:43:45 -07:00
6865652125 Fix process name in MagiskHide
close #3997
2021-03-24 04:43:45 -07:00
5113f6d375 Fix stop magiskhide 2021-01-23 18:13:15 -08:00
13fbf397d1 Isolated processes might still be hide-able 2021-01-15 20:22:49 -08:00
e8ba671fc2 Guard all injection features behind a global flag 2021-01-13 20:07:23 -08:00
9a28dd4f6e Implement MagiskHide through code injection 2021-01-12 03:28:00 -08:00
d2acd59ea8 Minor code refactoring 2021-01-12 00:07:48 -08:00
eb21c8b42e Code cleanups 2021-01-11 02:19:10 -08:00
70d67728fd Add global toggle for ptrace monitor 2021-01-10 19:27:54 -08:00
b36e6d987d Reorganize MagiskHide code
Prepare for zygote injection hiding
2021-01-10 17:11:00 -08:00
f9bde347bc Convert indentation to spaces
The tab war is lost
2020-12-30 22:11:24 -08:00
8e61080a4a Preparation for hiding isolated processes 2020-12-30 15:55:53 -08:00
086059ec30 Make sure boot stages are mutually exclusive 2020-12-15 03:40:37 -08:00
1e45c63ea5 Scan for zygote periodically
Fix #3417
2020-11-08 03:44:43 -08:00
b14a260827 Offset pid_set by 1
PID starts at 1, not 0
2020-11-08 02:12:35 -08:00
6dbd9bfb12 Place pthread_mutex_init() before init_list()
Fix crash in #2900

Signed-off-by: Shaka Huang <shakalaca@gmail.com>
2020-06-28 07:06:19 -07:00
51eeb89f67 Allow consecutive points 2020-05-23 14:58:17 -07:00
c3e045e367 Use daemon state to determine late prop hiding 2020-05-18 05:21:47 -07:00
97db49a57b Move vendor property manipulation to late start 2020-05-17 15:01:37 -07:00
eca2168685 Guard magiskhide state with mutexes 2020-05-17 15:01:37 -07:00
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
5fd574a14f Fix --remove-modules command 2020-04-30 01:27:48 -07:00
c9255ab31b Remove legacy migration
It has been quite a long time ago...
2020-04-18 23:46:56 -07:00
1e714af3cf Support MagiskHide when /sbin does not exist 2020-04-18 23:45:00 -07:00
a0998009c1 Small native code reorganization 2020-03-09 01:50:30 -07:00
af060b3132 General QoL changes 2019-12-13 00:37:06 -05:00
493068c073 Attempt to rescan zygote multiple times
Close #1654
2019-11-01 02:12:28 -04:00
34c65e13bc Fix strings
Close #2012
2019-10-31 12:39:54 -04:00
947dae4900 Rename classes and small adjustments 2019-09-25 23:55:39 -04:00
4cd4bfa1d7 Add ':' to allowed characters for magiskhide process name 2019-09-22 16:17:51 -04:00
cfad7dd317 Sanitize magiskhide targets
Fix #1785
2019-09-01 14:16:12 +08:00
b0e49a4cc8 Kill blastula pool when magiskhide init 2019-06-27 00:49:27 -07:00
8b7b05da68 Separate hide policies 2019-05-26 02:47:57 -07:00
23d3e56967 Add new util function 2019-05-25 21:42:51 -07:00
21984fac8b Add API for running independent proc_monitor test 2019-05-25 16:08:53 -07:00
515f346dcc Monitor app_process
Some stupid Samsung ROMs will spawn multiple zygote daemons. Since we
switched to ptrace based process monitoring, we have to know all zygote
processes to trace. This is an attempt to fix this issue.

Close #1272
2019-04-22 16:36:23 -04:00
d08b1a6639 Remove com.google.android.gms from default list
It seems that even adding this to the list doesn't 100% works on all
devices out there, and some even reported crashes on several Google
services. Disable it for now and do further investigations in the future.
2019-03-27 21:33:04 -04:00
f5f7fd9132 Add com.android.google gms to default hide list
Close #1235
2019-03-23 04:39:34 -04:00
f0240b1f06 Support Android Q new split sepolicy setup 2019-03-15 06:17:37 -04:00
dce0b6c05a Always detach all child threads before leaving 2019-03-12 16:48:01 -04:00
081074ad9d Better zygote process detection 2019-03-08 23:53:53 -05:00
82c864d57e Make zygote notifier more reliable 2019-03-06 18:22:04 -05:00
370015a853 Modernize database code (again) 2019-03-06 08:16:12 -05:00
6597b7adc0 Add MicroG DroidGuardHelper as target
MicroG uses a different package to handle DroidGuard service (SafetyNet),
but still uses the same com.google.android.gms.unstable process name.
Thanks to the changes in 4e53ebfe, we can target both official GMS
and MicroG SafetyNet services at the same time.
2019-03-06 05:43:52 -05:00
4e53ebfe44 Use both package name and process name as key
Different packages could potentially use the same process name,
and they shouldn't conflict with each other.
2019-03-06 05:40:52 -05:00
04ef1e6405 Make parse prop file a util function 2019-03-05 20:27:09 -05:00
b278d07b05 Switch to Zygote ptrace-ing
No matter if we use the old, buggy, error prone am_proc_start monitoring,
or the new APK inotify method, both methods rely on MagiskHide 'reacting'
fast enough to hijack the process before any detection has been done.

However, this is not reliable and practical. There are apps that utilize
native libraries to start detects and register SIGCONT signal handlers
to mitigate all existing MagiskHide process monitoring mechanism. So
our only solution is to hijack an app BEFORE it is started.

All Android apps' process is forked from zygote, so it is easily the
target to be monitored. All forks will be notified, and subsequent
thread spawning (Android apps are heaviliy multithreaded) from children
are also closely monitored to find the earliest possible point to
identify what the process will eventually be (before am_proc_bound).

ptrace is extremely complicated and very difficult to get right. The
current code is heaviliy tested on a stock Android 9.0 Pixel system,
so in theory it should work fine on most devices, but more tests and
potentially fixes are expected to follow this commit.
2019-03-05 20:23:27 -05:00