From 9e150b2c44d6daf25c3b19f568373f64e5716e45 Mon Sep 17 00:00:00 2001 From: backslashxx <118538522+backslashxx@users.noreply.github.com> Date: Sun, 18 May 2025 03:42:32 +0600 Subject: [PATCH] ksud/installer: /odm handling we move the folder out of system if it exists in real filesystem and it is not a symlink. this is already supported on init_event.rs so only handle_partition logic was needed to make it happen since KernelSU is using overlayfs, we need to move these out. Signed-off-by: backslashxx <118538522+backslashxx@users.noreply.github.com> --------- Signed-off-by: backslashxx <118538522+backslashxx@users.noreply.github.com> --- kernel/core_hook.c | 1 + userspace/ksud_magic/src/installer.sh | 2 +- userspace/ksud_overlayfs/src/installer.sh | 4 +++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/kernel/core_hook.c b/kernel/core_hook.c index 7ca786e3..dbac599c 100644 --- a/kernel/core_hook.c +++ b/kernel/core_hook.c @@ -636,6 +636,7 @@ int ksu_handle_setuid(struct cred *new, const struct cred *old) // fixme: use `collect_mounts` and `iterate_mount` to iterate all mountpoint and // filter the mountpoint whose target is `/data/adb` + try_umount("/odm", true, 0); try_umount("/system", true, 0); try_umount("/system_ext", true, 0); try_umount("/vendor", true, 0); diff --git a/userspace/ksud_magic/src/installer.sh b/userspace/ksud_magic/src/installer.sh index 20f60fa5..6f6ba58b 100644 --- a/userspace/ksud_magic/src/installer.sh +++ b/userspace/ksud_magic/src/installer.sh @@ -392,7 +392,7 @@ install_module() { handle_partition vendor true handle_partition system_ext true handle_partition product true - handle_partition odm false + handle_partition odm true # Handle replace folders for TARGET in $REPLACE; do diff --git a/userspace/ksud_overlayfs/src/installer.sh b/userspace/ksud_overlayfs/src/installer.sh index a993e332..3855d1d0 100644 --- a/userspace/ksud_overlayfs/src/installer.sh +++ b/userspace/ksud_overlayfs/src/installer.sh @@ -309,7 +309,8 @@ handle_partition() { return; fi - if [ -L "/system/$1" ] && [ "$(readlink -f /system/$1)" = "/$1" ]; then + # we move the folder to / only if it is a native folder that is not a symlink + if [ -d "/$1" ] && [ ! -L "/$1" ]; then ui_print "- Handle partition /$1" # we create a symlink if module want to access $MODPATH/system/$1 # but it doesn't always work(ie. write it in post-fs-data.sh would fail because it is readonly) @@ -406,6 +407,7 @@ install_module() { handle_partition vendor handle_partition system_ext handle_partition product + handle_partition odm if $BOOTMODE; then mktouch $NVBASE/modules/$MODID/update