mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-22 07:57:39 +00:00
Move devpts mount to magiskinit
This commit is contained in:
parent
554eda8fe1
commit
838e1e254d
@ -392,21 +392,6 @@ static void daemon_entry() {
|
||||
ssprintf(path, sizeof(path), "%s/" ROOTOVL, tmp);
|
||||
rm_rf(path);
|
||||
|
||||
// Use isolated devpts if kernel support
|
||||
if (access("/dev/pts/ptmx", F_OK) == 0) {
|
||||
ssprintf(path, sizeof(path), "%s/" SHELLPTS, tmp);
|
||||
if (access(path, F_OK)) {
|
||||
xmkdirs(path, 0755);
|
||||
xmount("devpts", path, "devpts", MS_NOSUID | MS_NOEXEC, "newinstance");
|
||||
char ptmx[64];
|
||||
ssprintf(ptmx, sizeof(ptmx), "%s/ptmx", path);
|
||||
if (access(ptmx, F_OK)) {
|
||||
xumount(path);
|
||||
rmdir(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fd = xsocket(AF_LOCAL, SOCK_STREAM | SOCK_CLOEXEC, 0);
|
||||
sockaddr_un addr = {.sun_family = AF_LOCAL};
|
||||
ssprintf(addr.sun_path, sizeof(addr.sun_path), "%s/" MAIN_SOCKET, tmp);
|
||||
|
@ -249,5 +249,18 @@ void MagiskInit::setup_tmp(const char *path) {
|
||||
|
||||
xmount(".", path, nullptr, MS_BIND, nullptr);
|
||||
|
||||
chdir(path);
|
||||
|
||||
// Use isolated devpts if kernel support
|
||||
if (access("/dev/pts/ptmx", F_OK) == 0) {
|
||||
xmkdirs(SHELLPTS, 0755);
|
||||
xmount("devpts", SHELLPTS, "devpts", MS_NOSUID | MS_NOEXEC, "newinstance");
|
||||
xmount(nullptr, SHELLPTS, nullptr, MS_PRIVATE, nullptr);
|
||||
if (access(SHELLPTS "/ptmx", F_OK)) {
|
||||
umount2(SHELLPTS, MNT_DETACH);
|
||||
rmdir(SHELLPTS);
|
||||
}
|
||||
}
|
||||
|
||||
chdir("/");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user