240 Commits

Author SHA1 Message Date
topjohnwu
6017ff2318 Close files, cleanup resourses 2017-05-02 04:55:55 +08:00
topjohnwu
e16d604d0d Implement Magic Mount 2017-05-01 01:58:52 +08:00
topjohnwu
d3d5703f3f Reduce duplicate code for MagiskBoot 2017-04-28 21:53:44 +08:00
topjohnwu
512e7be74f Add version info 2017-04-28 03:26:48 +08:00
topjohnwu
727abbea8f Cleanup magiskboot 2017-04-28 03:24:30 +08:00
topjohnwu
76f81ece62 Fix verbose output 2017-04-28 01:45:57 +08:00
topjohnwu
495654f9ff Small tweaks 2017-04-24 21:43:30 +08:00
topjohnwu
4c96d23f48 Some minor updates 2017-04-22 17:12:54 +08:00
topjohnwu
9bc8f6e9d7 Add common script support 2017-04-22 17:12:54 +08:00
topjohnwu
e00e6509ee Add error code for magiskhide 2017-04-22 17:12:54 +08:00
topjohnwu
be5739508b Isolate root daemon from requests 2017-04-22 17:12:54 +08:00
topjohnwu
38c867ea94 Some fixes 2017-04-22 17:12:54 +08:00
topjohnwu
2a985ce6c0 Add magiskhide list management 2017-04-22 17:12:54 +08:00
topjohnwu
b2f8792873 Add more Android O selinux stuff 2017-04-22 17:12:54 +08:00
topjohnwu
2065133e2d Update policy rules for Android O 2017-04-22 17:12:54 +08:00
topjohnwu
102a7f8723 Change flags 2017-04-22 17:12:54 +08:00
topjohnwu
e9afc15719 Fix magiskhide daemon enable/disable 2017-04-22 17:12:54 +08:00
topjohnwu
08527dde9b Auto start magiskhide 2017-04-22 17:12:54 +08:00
topjohnwu
d9c3a3c9a9 Remove su_device auto transit 2017-04-22 17:12:54 +08:00
topjohnwu
fe89f9e55e Update to newer functions in resetprop 2017-04-22 17:12:54 +08:00
topjohnwu
73802aabac Fix compile issue when using NDK Unified Headers 2017-04-22 17:12:54 +08:00
topjohnwu
bc66733289 Add Android O sepolicy patches 2017-04-22 17:12:54 +08:00
topjohnwu
f4c93b2251 Update resetprop for Android O support
Updated to upstream https://android.googlesource.com/platform/bionic.git
2017-04-22 17:12:54 +08:00
topjohnwu
8a2f0063d4 Improve magiskhide process/thread management 2017-04-22 17:12:54 +08:00
topjohnwu
dfe4b33f2f Integrate sepolicy patching with MagiskSU fixed 2017-04-22 17:12:54 +08:00
topjohnwu
2f7cfa7ab2 Link binaries when daemon started 2017-04-22 17:12:54 +08:00
topjohnwu
bdcb813ee6 Add block rw support 2017-04-22 17:12:54 +08:00
topjohnwu
f0751007f3 Update main function 2017-04-22 17:12:54 +08:00
topjohnwu
6ad993704c Integrate MagiskSU into Magisk daemon 2017-04-22 17:12:54 +08:00
topjohnwu
796c3009c7 Refactor resetprop 2017-04-22 17:12:54 +08:00
topjohnwu
144ff5e716 Integrate MagiskHide into Magisk Daemon 2017-04-22 17:12:54 +08:00
topjohnwu
054a1e5ea4 Add magisk daemon 2017-04-22 17:12:54 +08:00
topjohnwu
a223f6056e Add zygote namespace detection 2017-04-22 17:12:54 +08:00
topjohnwu
a1fd7704e0 Fix vector bug 2017-04-22 17:12:54 +08:00
topjohnwu
b94227efc9 Add process searching 2017-04-22 17:12:54 +08:00
topjohnwu
3a7e782c07 Remove separate binary support for tools rely on daemon 2017-04-22 17:12:54 +08:00
topjohnwu
8f6b33d790 Rewrite magiskhide 2017-04-22 17:12:54 +08:00
topjohnwu
f476daa041 Change parts of library to shared
libsqlite and libselinux are shipped with Android systems
We build them here for the compiler to link against it,
we actually use the one in /system/lib(64)
2017-04-22 17:12:54 +08:00
topjohnwu
acfde9458d Merge magiskpolicy, magiskhide, resetprop, magisksu 2017-04-22 17:12:54 +08:00
topjohnwu
82e969627a Start unifying with log monitor 2017-04-22 17:12:54 +08:00
topjohnwu
40766b3375 Do not use psuedo permissive, hide instead 2017-04-03 23:28:18 +08:00
topjohnwu
d274e45587 Fix SuperSU installation 2017-03-31 06:25:22 +08:00
topjohnwu
0a0eb3f710 Update policy rules 2017-03-31 02:54:39 +08:00
topjohnwu
67f347f880 Live patch policy in service mode 2017-03-30 02:29:10 +08:00
topjohnwu
81542fc6a8 Fix MTK header support 2017-03-29 04:35:35 +08:00
topjohnwu
5aced279d6 Add legacy lz4 mode support 2017-03-29 04:35:35 +08:00
topjohnwu
3f016f785f Handle selinux for Samsung in binary 2017-03-29 02:23:10 +08:00
topjohnwu
8c7fbe20f9 Daemons cannot run in /data on Samsung, move to magisk.img 2017-03-27 07:23:53 +08:00
topjohnwu
6e8e4ad5da Fix compile warnings 2017-03-26 23:40:34 +08:00
Jasmin Hassan
760b6385f1 list_monitor: use IN_CLOSE_WRITE instead of IN_MODIFY 2017-03-26 21:49:11 +08:00
Jasmin Hassan
91527500f9 proc_monitor: Support newer kernels am_proc_start format 2017-03-26 21:49:11 +08:00
Jasmin Hassan
e87d989ca3 Fix proccess monitor for lsskernel 6.0.1 (3.8UX) 2017-03-26 21:49:11 +08:00
topjohnwu
0d10b812fe Handle MagiskSU and MagiskHide differently 2017-03-19 05:00:12 +08:00
topjohnwu
b4fe4f3d10 Rename sepolicy-inject 2017-03-18 17:26:30 +08:00
topjohnwu
ba93fcbda0 Prevent multirom crashes 2017-03-18 16:57:29 +08:00
topjohnwu
88d19a4ca4 Several fixes 2017-03-18 16:57:04 +08:00
topjohnwu
af7b9ea898 Update to MagiskSU 8 2017-03-16 06:58:43 +08:00
topjohnwu
09cd0468cf Stop after reading TRAILER!!! 2017-03-16 06:46:32 +08:00
topjohnwu
7877ac0c3b Well, /dev/zero cannot be used like that... 2017-03-13 05:05:51 +08:00
topjohnwu
1442e29d0e Update size in MTK headers 2017-03-13 04:27:56 +08:00
topjohnwu
c421e45fa0 Small improvements and bug fixes 2017-03-12 19:22:15 +08:00
topjohnwu
1a3c522c94 Various improvements for Magisk installation 2017-03-12 18:12:16 +08:00
topjohnwu
212a303347 Add auto cpio backup and restore 2017-03-10 07:52:59 +08:00
topjohnwu
3f3568d8af More cpio features 2017-03-10 04:15:37 +08:00
topjohnwu
1e3bcfc8cd Add basic cpio features 2017-03-08 00:54:23 +08:00
topjohnwu
a4ce9f6f05 Add compress, decompress, cleanup command 2017-03-05 01:51:13 +08:00
topjohnwu
65dc99744e Use our own zlib for static link and ZLIB_CONST flag 2017-03-04 21:18:24 +08:00
topjohnwu
c6d4740b0c Separate utility functions 2017-03-04 21:16:59 +08:00
topjohnwu
9f91c8b59d Improvements 2017-03-04 00:04:15 +08:00
topjohnwu
2b3b087c29 Add bzip2 support 2017-03-02 05:23:31 +08:00
topjohnwu
e08d46aa76 Add lz4 support 2017-03-02 04:12:47 +08:00
topjohnwu
feccc97a14 Fix typo 2017-03-01 00:50:56 +08:00
topjohnwu
77eec3d21d Support legacy lzma 2017-03-01 00:47:59 +08:00
topjohnwu
ecaafd1b70 Fix header when repack from ELF 2017-03-01 00:15:38 +08:00
topjohnwu
0d51997e46 Add xz support 2017-02-28 21:56:13 +08:00
topjohnwu
463cbceb07 Cleanup Android.mk 2017-02-28 17:53:04 +08:00
topjohnwu
1437c5c63f Add ndk-compression with liblzma 2017-02-28 17:24:27 +08:00
topjohnwu
52f1d50902 Project restructure 2017-02-28 16:59:21 +08:00
topjohnwu
a839cb787e Rename bootimgtool to magiskboot 2017-02-28 05:43:49 +08:00
topjohnwu
f621fb2060 Add gzip native support 2017-02-28 05:40:27 +08:00
topjohnwu
2ccd8b8838 Cleanup hexpatch 2017-02-25 03:50:26 +08:00
topjohnwu
7ef0746c52 Add ELF support 2017-02-25 03:29:12 +08:00
topjohnwu
6f609f0dd7 Several improvements 2017-02-24 15:53:17 +08:00
topjohnwu
ee2a30470a Boot IMG tools complete re-write
Fix #27, Fix #35, Fix #68, Fix #70, Fix #71, Fix #72, Fix #75, Fix #87
2017-02-24 07:45:48 +08:00
topjohnwu
e11fb2c09e Fix compile errors 2017-02-20 11:55:32 +08:00
topjohnwu
3e2e171407 Update su 2017-02-14 06:41:52 +08:00
topjohnwu
06d3b94804 Several improvements 2017-02-07 07:50:55 +08:00
topjohnwu
14204c9bfc Busybox path changed; stock one is enough for detection 2017-02-06 00:14:03 +08:00
topjohnwu
472255924a Auto switch to pseudo enforced if permissive 2017-02-05 23:43:01 +08:00
topjohnwu
5e92b4faa9 Update binaries 2017-02-04 18:59:52 +08:00
topjohnwu
d4149d4b7a Update native parts 2017-02-01 06:03:05 +08:00
topjohnwu
3315228a90 Properly handle loading prop files
1. Add new trigger "load_magisk_props_action" in init.magisk.rc
2. Patch init*.rc with new trigger
3. Update resetprop to handle prop value with spaces
4. Handle the case when modules contains file/folder names with spaces
2017-01-09 02:23:00 +08:00
topjohnwu
f72205c401 Fix binary outdated complain 2017-01-03 09:37:45 +08:00
topjohnwu
b4cfe6e9c0 Proper vendor support 2017-01-02 17:48:34 +08:00
topjohnwu
2b72f40cec Upgrade phh su 2017-01-02 01:28:24 +08:00
topjohnwu
ff5c0d6361 MagiskHide small fix 2017-01-01 20:31:08 +08:00
topjohnwu
f9fea265cf Small updates for MagiskHide 2017-01-01 18:54:13 +08:00
topjohnwu
668601ca23 Separate all binaries and makefile 2016-12-31 02:44:24 +08:00
topjohnwu
99406f2099 Separate all Android.mk files 2016-12-30 06:06:19 +08:00
topjohnwu
632b3cb9ae Higher priority; compare whole string instead substr 2016-12-30 06:05:33 +08:00
topjohnwu
0bf04c04f9 Final fix for MagiskHide, all is well! 2016-12-29 23:25:11 +08:00
topjohnwu
dc29018ec0 Reduce wait interval and various bug fixes 2016-12-28 15:28:42 +08:00
topjohnwu
b6412afe96 Fix Magisk Hide losing root issue
This is the issue that has been haunting since day 1. Root and mounted files randomly disappears, and only an reboot can fix it.
The issue is that Zygote requires some time to isolate the mount namespace for the children it forks (read: most processes), so in rare cases such as the CPU is on heavy load, or CPU is in deep sleep, it takes longer than usual to finish the mount namespace isolation. Magisk Hide kicks in before the isolation is done, and it will switch to Zygote's namespace and do the unmounting. All children will then lose the mounted files, which includes root.
The solution is to first find the namespace id of Zygote, and wait a small period of time and retry if the namespace isn't isolated yet.
2016-12-28 04:02:35 +08:00
topjohnwu
b2431b982f Prettify code 2016-12-11 05:10:48 +08:00
topjohnwu
8d6d619eed Fork once only
Right now there are three threads (process)
1. Main thread in parent: monitor logcat
2. Second thread in parent: monitor hidelist
3. Children: switch namespace and unmounts
2016-12-11 04:56:01 +08:00
topjohnwu
70e332b9e8 MagiskHide small update 2016-12-11 03:41:29 +08:00
topjohnwu
0a53c42a8a Improve phh su installation 2016-12-10 23:48:24 +08:00
topjohnwu
0ccc92dc1e Minor restructure 2016-12-09 15:57:10 +08:00
topjohnwu
6e3bb48574 Add su binary into Magisk 2016-12-06 04:49:35 +08:00
topjohnwu
16d7ae62bd Move selinux submodule 2016-12-06 03:09:15 +08:00
topjohnwu
0e69201f05 Remove UID check, not reliable.... 2016-11-14 04:27:43 +08:00
topjohnwu
f8fdaf5c1f Initialize is not needed 2016-11-13 21:22:04 +08:00
topjohnwu
1f3b81338c Fix Moto DTB issue 2016-11-13 21:03:00 +08:00
topjohnwu
dbbc85719e MagiskHide: Unmount cache mounts and check UID 2016-11-13 19:27:01 +08:00
topjohnwu
0ddb6c3f10 Various small changes 2016-11-13 16:58:43 +08:00
topjohnwu
e13281726c Add bootanim, host, busybox 2016-11-09 05:17:14 +08:00
topjohnwu
3068738a70 MagiskHide small tweak 2016-11-07 23:57:21 +08:00
topjohnwu
0498540439 Magisk Hide: Unmount dummy skeleton 2016-11-06 02:09:14 +08:00
topjohnwu
bcdd74514f Adjust scripts for resetprop 2016-11-05 02:38:10 +08:00
topjohnwu
1d0c36a0ab Add resetprop to Magisk 2016-11-05 02:38:10 +08:00
topjohnwu
a34ea8f131 Magisk Hide Massive Update 2016-11-01 04:21:43 +08:00
Pierre-Hugues Husson
d9fc5650b8 Oops, MTK rootfs/recovery detection had wrong offset 2016-10-30 06:57:50 +08:00
topjohnwu
9ea028f5ab Various updates, prepare for Multirom support 2016-10-30 06:50:06 +08:00
topjohnwu
3255ca3ea4 Remove unnecessary statics 2016-10-30 06:08:23 +08:00
topjohnwu
a06ef6fe25 Magisk v8 2016-10-19 06:22:00 +08:00
topjohnwu
f785dcac3d Magisk Hide: Auto unmount necessary files 2016-10-15 05:18:16 +08:00
topjohnwu
aa54ef10ae Magisk Hide: Unmount everything 2016-10-06 17:53:52 +08:00
topjohnwu
14946da163 Magisk Hide done 2016-10-06 04:33:33 +08:00
topjohnwu
5f9bcfbefe Change the name to magiskhide 2016-10-06 02:21:12 +08:00
topjohnwu
aa2eed2c38 Make hidesu hide Magisk and read config file 2016-10-06 02:17:21 +08:00
Pierre-Hugues Husson
6bff6e9cff [hidesu] Don't suicide 2016-10-05 04:11:07 +08:00
Pierre-Hugues Husson
023d369b74 Move to android-21 NDK 2016-10-05 04:10:24 +08:00
Pierre-Hugues Husson
c9d4241afe PoC++ of hidesu
This uses logcat -b events to search for new process
2016-10-05 04:10:05 +08:00
Pierre-Hugues Husson
e1279c29c2 Add hidesu program.
This is a test program, this will probably be integrated into su daemon.
This hides su by bind-mounting something (/system) over /sbin, so that
there is no /sbin/su binary.
Usage:
hidesu /proc/<one pid of the namespace>/ns/mnt

This uses the fact that when a program wants access to /sdcard, zygote
does this using mount namespaces, so every program accessing /sdcard
will be in a custom mount namespace, that can be modified.
2016-10-05 04:07:48 +08:00
topjohnwu
e4ace49536 Update to release v7 2016-10-03 04:34:50 +08:00
topjohnwu
88a97319cc Add zip static files 2016-09-14 10:31:13 +08:00
topjohnwu
0f12a9de3b Update sepolicy-inject 2016-09-13 06:23:00 +08:00
topjohnwu
937b9009e0 Cleanup and separate submodule 2016-09-13 02:53:08 +08:00
Pierre-Hugues Husson
66b6098d32 MTK ramdisk: Specify whether ramdisk is for boot.img or recovery.img 2016-09-09 05:22:03 +08:00
topjohnwu
348bc1d0fc Add extract, repack, hexpatch, sepolicy-injection 2016-09-08 20:59:48 +08:00