Compare commits

...

7 Commits

Author SHA1 Message Date
topjohnwu
a27e30cf54 Update release notes 2021-01-17 06:08:15 -08:00
topjohnwu
79140c7636 Proper xxread and xwrite implementation 2021-01-17 01:42:45 -08:00
topjohnwu
1f4c595cd3 Revert to old su -c behavior 2021-01-16 23:59:31 -08:00
topjohnwu
b5b62e03af Fix copySepolicyRules logic 2021-01-16 21:45:45 -08:00
topjohnwu
67e2a4720e Fix xxread false negatives
Fix #3710
2021-01-16 21:43:53 -08:00
topjohnwu
f5c2d72429 Also log pid and tid 2021-01-16 16:10:47 -08:00
topjohnwu
2f5331ab48 Update README 2021-01-16 05:02:39 -08:00
11 changed files with 67 additions and 28 deletions

View File

@@ -15,11 +15,11 @@ Here are some feature highlights:
## Downloads ## Downloads
[![](https://img.shields.io/badge/Magisk%20Manager-v8.0.5-green)](https://github.com/topjohnwu/Magisk/releases/download/manager-v8.0.5/MagiskManager-v8.0.5.apk) [![](https://img.shields.io/badge/Magisk%20Manager-v8.0.6-green)](https://github.com/topjohnwu/Magisk/releases/download/manager-v8.0.6/MagiskManager-v8.0.6.apk)
[![](https://img.shields.io/badge/Magisk%20Manager-Canary-red)](https://raw.githubusercontent.com/topjohnwu/magisk_files/canary/app-debug.apk) [![](https://img.shields.io/badge/Magisk%20Manager-Canary-red)](https://raw.githubusercontent.com/topjohnwu/magisk_files/canary/app-debug.apk)
<br> <br>
[![](https://img.shields.io/badge/Magisk-v21.2-blue)](https://github.com/topjohnwu/Magisk/releases/tag/v21.2) [![](https://img.shields.io/badge/Magisk-v21.3-blue)](https://github.com/topjohnwu/Magisk/releases/tag/v21.3)
[![](https://img.shields.io/badge/Magisk%20Beta-v21.2-blue)](https://github.com/topjohnwu/Magisk/releases/tag/v21.2) [![](https://img.shields.io/badge/Magisk%20Beta-v21.3-blue)](https://github.com/topjohnwu/Magisk/releases/tag/v21.3)
## Useful Links ## Useful Links

View File

@@ -361,9 +361,10 @@ abstract class MagiskInstallImpl : KoinComponent {
} }
private fun copySepolicyRules(): Boolean { private fun copySepolicyRules(): Boolean {
if (Info.remote.magisk.versionCode >= 21100) return true if (Info.remote.magisk.versionCode >= 21100) {
// Copy existing rules for migration // Copy existing rules for migration
"copy_sepolicy_rules".sh() "copy_sepolicy_rules".sh()
}
return true return true
} }

View File

@@ -1,8 +1,8 @@
## v8.0.7
- Fix sepolicy rule migration when upgrading
## v8.0.6 ## v8.0.6
- Minor UI changes - Minor UI changes
- Update internal scripts - Update internal scripts
## v8.0.5
- Fix sepolicy rule copying

View File

@@ -1,5 +1,4 @@
# Magisk Documentation # Magisk Documentation
(Updated on 2020.11.13)
- [Installation Instructions](install.md) - [Installation Instructions](install.md)
- [Frequently Asked Questions](faq.md) - [Frequently Asked Questions](faq.md)

View File

@@ -1,10 +1,18 @@
# Magisk Manager Changelog # Magisk Manager Changelog
### v8.0.5 ### v8.0.7
- Fix sepolicy rule migration when upgrading
### v8.0.6
- Minor UI changes - Minor UI changes
- Update internal scripts - Update internal scripts
### v8.0.5
- Fix sepolicy rule copying
### v8.0.4 ### v8.0.4
- A lot of stability changes and minor bug fixes - A lot of stability changes and minor bug fixes

View File

@@ -1,5 +1,10 @@
# Magisk Changelog # Magisk Changelog
### v21.4
- [MagiskSU] Fix `su -c` behavior that broke many root apps
- [General] Properly handle read/write over sockets (the `broken pipe` issue)
### v21.3 ### v21.3
- [MagiskInit] Avoid mounting `f2fs` userdata as it may result in kernel crashes. This shall fix a lot of bootloops - [MagiskInit] Avoid mounting `f2fs` userdata as it may result in kernel crashes. This shall fix a lot of bootloops

View File

@@ -1,7 +1,14 @@
## 2021.1.16 Magisk v21.3 ## 2021.1.17 Magisk v21.4
**Update**: v21.4 adds more regression hot fixes.
Happy 2021! v21.3 adds a workaround for devices with buggy F2FS Linux kernel drivers. This F2FS bug may cause bootloops on many devices. Checkout the full [v21.0 release notes](https://topjohnwu.github.io/Magisk/releases/21000.html) if coming from older releases. Happy 2021! v21.3 adds a workaround for devices with buggy F2FS Linux kernel drivers. This F2FS bug may cause bootloops on many devices. Checkout the full [v21.0 release notes](https://topjohnwu.github.io/Magisk/releases/21000.html) if coming from older releases.
### v21.4
- [MagiskSU] Fix `su -c` behavior that broke many root apps
- [General] Properly handle read/write over sockets (the `broken pipe` issue)
### v21.3 ### v21.3
- [MagiskInit] Avoid mounting `f2fs` userdata as it may result in kernel crashes. This shall fix a lot of bootloops - [MagiskInit] Avoid mounting `f2fs` userdata as it may result in kernel crashes. This shall fix a lot of bootloops

View File

@@ -27,6 +27,6 @@ android.injected.testOnly=false
kapt.incremental.apt=true kapt.incremental.apt=true
# Magisk # Magisk
magisk.versionCode=21202 magisk.versionCode=21400
magisk.ndkVersion=21d magisk.ndkVersion=21d
magisk.fullNdkVersion=21.3.6528147 magisk.fullNdkVersion=21.3.6528147

View File

@@ -207,7 +207,7 @@ static int magisk_log(int prio, const char *fmt, va_list ap) {
localtime_r(&tv.tv_sec, &tm); localtime_r(&tv.tv_sec, &tm);
size_t len = strftime(buf, sizeof(buf), "%m-%d %T", &tm); size_t len = strftime(buf, sizeof(buf), "%m-%d %T", &tm);
int ms = tv.tv_usec / 1000; int ms = tv.tv_usec / 1000;
len += sprintf(buf + len, ".%03d %c : ", ms, type); len += sprintf(buf + len, ".%03d %*d %*d %c : ", ms, 5, getpid(), 5, gettid(), type);
strcpy(buf + len, fmt); strcpy(buf + len, fmt);
return vfprintf(local_log_file.get(), buf, args); return vfprintf(local_log_file.get(), buf, args);
} }

View File

@@ -105,9 +105,7 @@ int su_client_main(int argc, char *argv[]) {
for (int i = optind - 1; i < argc; ++i) { for (int i = optind - 1; i < argc; ++i) {
if (!su_req.command.empty()) if (!su_req.command.empty())
su_req.command += ' '; su_req.command += ' ';
su_req.command += '\'';
su_req.command += argv[i]; su_req.command += argv[i];
su_req.command += '\'';
} }
optind = argc; optind = argc;
break; break;

View File

@@ -1,7 +1,5 @@
#include <sched.h> #include <sched.h>
#include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <errno.h>
#include <pthread.h> #include <pthread.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/types.h> #include <sys/types.h>
@@ -63,12 +61,24 @@ int xopenat(int dirfd, const char *pathname, int flags, mode_t mode) {
return fd; return fd;
} }
// Write exact same size as count
ssize_t xwrite(int fd, const void *buf, size_t count) { ssize_t xwrite(int fd, const void *buf, size_t count) {
int ret = write(fd, buf, count); size_t write_sz = 0;
if (count != ret) { ssize_t ret;
PLOGE("write"); do {
ret = write(fd, (byte *) buf + write_sz, count - write_sz);
if (ret < 0) {
if (errno == EINTR)
continue;
PLOGE("write");
return ret;
}
write_sz += ret;
} while (write_sz != count && ret != 0);
if (write_sz != count) {
PLOGE("write (%zu != %zu)", count, write_sz);
} }
return ret; return write_sz;
} }
// Read error other than EOF // Read error other than EOF
@@ -82,11 +92,22 @@ ssize_t xread(int fd, void *buf, size_t count) {
// Read exact same size as count // Read exact same size as count
ssize_t xxread(int fd, void *buf, size_t count) { ssize_t xxread(int fd, void *buf, size_t count) {
int ret = read(fd, buf, count); size_t read_sz = 0;
if (count != ret) { ssize_t ret;
PLOGE("read (%zu != %d)", count, ret); do {
ret = read(fd, (byte *) buf + read_sz, count - read_sz);
if (ret < 0) {
if (errno == EINTR)
continue;
PLOGE("read");
return ret;
}
read_sz += ret;
} while (read_sz != count && ret != 0);
if (read_sz != count) {
PLOGE("read (%zu != %zu)", count, read_sz);
} }
return ret; return read_sz;
} }
int xpipe2(int pipefd[2], int flags) { int xpipe2(int pipefd[2], int flags) {
@@ -242,7 +263,7 @@ ssize_t xrecvmsg(int sockfd, struct msghdr *msg, int flags) {
return rec; return rec;
} }
int xpthread_create(pthread_t *thread, const pthread_attr_t *attr, int xpthread_create(pthread_t *thread, const pthread_attr_t *attr,
void *(*start_routine) (void *), void *arg) { void *(*start_routine) (void *), void *arg) {
errno = pthread_create(thread, attr, start_routine, arg); errno = pthread_create(thread, attr, start_routine, arg);
if (errno) { if (errno) {