You've already forked Zygisk-Assistant
mirror of
https://github.com/snake-4/Zygisk-Assistant.git
synced 2025-09-06 06:37:02 +00:00
Added remount function and changed bind mount...
prefix.
This commit is contained in:
@@ -11,6 +11,7 @@ using zygisk::AppSpecializeArgs;
|
||||
using zygisk::ServerSpecializeArgs;
|
||||
|
||||
void do_unmount();
|
||||
void do_remount();
|
||||
|
||||
DCL_HOOK_FUNC(static int, unshare, int flags)
|
||||
{
|
||||
@@ -84,6 +85,7 @@ public:
|
||||
}
|
||||
|
||||
do_unmount();
|
||||
do_remount();
|
||||
}
|
||||
|
||||
void preServerSpecialize(ServerSpecializeArgs *args) override
|
||||
|
||||
@@ -16,7 +16,7 @@ static bool shouldUnmount(const mountinfo_entry_t &mount_info)
|
||||
const auto &root = mount_info.getRoot();
|
||||
|
||||
// Unmount all module bind mounts
|
||||
if (root.rfind("/adb/modules", 0) == 0)
|
||||
if (root.rfind("/adb/", 0) == 0)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@@ -95,3 +95,27 @@ void do_unmount()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void do_remount()
|
||||
{
|
||||
std::vector<mount_entry_t> mounts = parseMountsFromPath("/proc/self/mounts");
|
||||
auto data_mount_it = std::find_if(mounts.begin(), mounts.end(), [](const mount_entry_t &mount)
|
||||
{ return mount.getMountPoint() == "/data"; });
|
||||
if (data_mount_it != mounts.end())
|
||||
{
|
||||
const auto &options = data_mount_it->getOptions();
|
||||
|
||||
// If errors=remount-ro, remount it with errors=continue
|
||||
if (options.find("errors") != options.end() && options.at("errors") == "remount-ro")
|
||||
{
|
||||
if (mount(NULL, "/data", NULL, MS_REMOUNT, "errors=continue") == 0)
|
||||
{
|
||||
LOGD("mount(NULL, \"/data\", NULL, MS_REMOUNT, \"errors=continue\") returned 0");
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGE("mount(NULL, \"/data\", NULL, MS_REMOUNT, \"errors=continue\") returned -1: %d (%s)", errno, strerror(errno));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user