diff --git a/native/jni/su/su_daemon.cpp b/native/jni/su/su_daemon.cpp index d9f022e4d..1cb6298d4 100644 --- a/native/jni/su/su_daemon.cpp +++ b/native/jni/su/su_daemon.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -308,14 +309,13 @@ void su_daemon_handler(int client, struct ucred *credential) { break; case NAMESPACE_MODE_REQUESTER: LOGD("su: use namespace of pid=[%d]\n", ctx.pid); - if (switch_mnt_ns(ctx.pid)) { - LOGD("su: setns failed, fallback to isolated\n"); - xunshare(CLONE_NEWNS); - } + if (switch_mnt_ns(ctx.pid)) + LOGD("su: setns failed, fallback to global\n"); break; case NAMESPACE_MODE_ISOLATE: LOGD("su: use new isolated namespace\n"); xunshare(CLONE_NEWNS); + xmount(nullptr, "/", nullptr, MS_PRIVATE | MS_REC, nullptr); break; }