Commit Graph

112 Commits

Author SHA1 Message Date
2bde8a1975 EMUI's logcat will change output file's permission and break ADBD 2018-07-16 06:42:36 +08:00
bf9927c7dd Sync source with AOSP 2018-07-14 04:34:48 +08:00
f339a087a2 Let Magisk compile against SDK 16 2018-07-13 22:14:32 +08:00
1affb91f17 Support compiling against lower SDK
Reduce even more size for static binaries
2018-07-13 05:41:29 +08:00
c6fc0e587e Support hardlink based proc ns 2018-07-11 23:41:38 +08:00
7ed2c077de Support deodexed ROM on Oreo 2018-07-07 01:37:04 +08:00
1283167595 Maintain our own set of loop devices 2018-07-07 01:32:58 +08:00
23c2e22910 Update image functions 2018-07-06 22:04:06 +08:00
f44b2dbd45 Rename log_monitor -> log_daemon 2018-07-06 07:57:18 +08:00
46ee2c3f4e Improve handshake between the 2 daemons 2018-07-06 07:51:17 +08:00
5d5ec08566 Test the log buffers before running command 2018-07-06 07:32:16 +08:00
ef175e3cbe Open log file in append mode 2018-07-04 23:46:40 +08:00
e7a2144def Optimize magiskhide to work with the log daemon 2018-07-04 01:52:23 +08:00
52a2c6958b Optimize log daemon 2018-07-03 22:25:39 +08:00
6c4d81b1e9 Invincible mode implemented in magisklogd 2018-07-03 01:38:19 +08:00
c88dc8795b Single log file 2018-07-02 22:48:26 +08:00
a8030c39b1 Separate logging into its own daemon 2018-07-02 22:11:28 +08:00
7243b9e72f Improve log_monitor implementation 2018-07-01 18:18:12 +08:00
d149af9628 Fix bootloop when upgrading from older Magisk 2018-07-01 14:58:31 +08:00
528634d755 Remove unused code 2018-06-27 06:04:16 +08:00
e579f314a6 Fix MagiskSU force denying root access 2018-06-26 18:46:18 +08:00
e837bdc8ad Update BusyBox
BusyBox is unable to run properly on non-root applications due to seccomp introduced in Android 8.0.
The SDK-21 libc.a has system call wrappers that uses the system calls on the whitelist, so binaries compiled with the updated libc can work properly.
2018-06-25 16:11:31 +08:00
7265450e2e Precise free space calculation for magisk.img
1. Introduce new applet: imgtool for better separation from the main program
2. Actually mount the image and check statvfs for free space in the image

This shall eliminate any possible module installation failure from image resizing issues.
2018-06-22 06:18:06 +08:00
058dbc9f9e Add more indentation 2018-06-21 18:11:43 +08:00
a82ef6bd35 MagiskHide: add ro.boot.vbmeta.device_state=locked 2018-06-19 14:23:06 -07:00
312466aaf8 Prevent setting zero over than bound
The &cmd will return a pointer which point to a pointer of cmdline.
It is a memory address which is usually 8 bytes in 64 bits machine.

However, the struct cmdline is 4 bytes. This will cause setting zero
beyond the bound.

Below is a simple example to show the differentiation:

struct cmdline {
        char skip_initramfs;
        char slot[3];
};

static void parse_cmdline(struct cmdline *cmd)
{
        printf("%lu\n", sizeof(*cmd)); /* 4 */
        printf("%lu\n", sizeof(&cmd)); /* 8 */
}

int main()
{
        struct cmdline cmd;
        parse_cmdline(&cmd);
        return 0;
}

This patch prevents this.

Signed-off-by: npes87184 <npes87184@gmail.com>
2018-06-19 14:22:11 -07:00
44395e8ff0 Fix root loss issue when MagiskHide is enabled
In previous implementations, proc_monitor checks whether the mount namespace of an app is actually separated from zygote using a list generated at startup.
However, for some unknown reason, some devices (e.g. Samsung) has multiple zygote servers running in the background.
This means that app processes spawned from the unlisted zygotes are not checked whether the separation is done or not, causing MagiskHide unmount stuffs in the namespace of zygote, and since zygote is the "mother" of all apps, all apps will no longer have root access.

Since I'm not sure of the reason why multiple zygotes exists, so instead of checking the namespace against a list, compare the current namespace against the parent process's namespace.
This will make sure the namespace is NOT the same as the parent process, which is supposed to be the zygote server.
2018-06-20 04:55:34 +08:00
838f3cc01e Simplify hiding conditions 2018-06-17 05:16:52 +08:00
4d5841332a Change to applet name to prevent showing magisk.bin 2018-06-17 01:47:55 +08:00
9b41976252 Preserve last log 2018-06-17 01:38:58 +08:00
d08fd0561a Remove invincible mode 2018-06-17 01:28:29 +08:00
a6958ac139 Fix adbd on GSIs 2018-06-17 01:25:27 +08:00
d7d76f54cc Install stub APK when needed 2018-06-14 05:09:54 +08:00
970a2e87b3 Bundle in stub APK into magiskinit 2018-06-14 02:54:38 +08:00
cabaae8403 MagiskSU improvements 2018-06-14 02:54:33 +08:00
f2064a84ed Move database logic outside of MagiskSU 2018-06-13 04:34:05 +08:00
3f83919e09 Fix bootloops when flashing Magisk after data wipe on FBE devices 2018-06-11 02:26:18 +08:00
d2e8ecc646 Fix error return code when patching dtb 2018-06-10 20:36:18 +08:00
30eb4074cb Update binary dump method 2018-06-10 16:55:00 +08:00
9929e7d8e8 Remove update file on boot
It's not important to check the return value of unlink(2) or even verify
that the file exists. If this code is running, it means the system has
rebooted, and thus the update file, if any, should be removed so that
MagiskManager doesn't keep displaying the same message. We also handle
this before we handle "disable" so that disabled modules don't keep
requesting a reboot to update.
2018-06-10 03:02:56 +08:00
f6ee252572 magiskboot: Check dtb header content to avoid false positives 2018-06-10 03:02:13 +08:00
0abdfda5a2 Fix busybox issues 2018-06-09 15:45:56 +08:00
a7ceb04cb7 Fix early mount on S9/S9+
Unlike other common OEMs, Samsung use uppper case partition name.

e.g: /dev/block/platform/11120000.ufs/by-name/SYSTEM

This will cause setup_block() fails to find a match partition.
Thus, we should use strcasecmp instead of strcmp.

Signed-off-by: msdx321 <msdx321@gmail.com>
2018-06-03 17:02:30 +08:00
b3cd83bbca magiskinit: Only unmount /system and /vendor if it was mounted by magisk
This fixes an issue where if /system or /vendor was already mounted
prior to magiskinit running, then they would get unmounted.

Signed-off-by: Andrew Gunnerson <andrewgunnerson@gmail.com>
2018-06-03 15:25:38 +08:00
b8bd83ba05 Update busybox to 1.28.4 2018-06-03 15:17:31 +08:00
34dcf49fbc Update restorecon implementation 2018-06-03 14:43:03 +08:00
f31a24b16d Update setenv functions (also fixes uninstalling) 2018-05-26 23:14:09 +08:00
b436bce565 Minor optimizations 2018-05-26 21:25:59 +08:00
bcdadc6581 Update busybox 2018-05-20 02:34:06 +08:00
36448191b7 Fix applet invocation 2018-05-20 00:49:48 +08:00