kernel: require path_umount backporting

Most kernel builders have to touch their kernel source code anyway so
we might as well tell them to backport path_umount to achieve some sort
of feature parity.

This enforces a path_umount backport, not a suggestion.
Its a requirement from now on.

You will backport path_umount and you will like it.
This commit is contained in:
backslashxx
2024-12-17 22:45:23 +06:00
committed by Rifat Azad
parent 68eb2fb662
commit 1b70c44d89
2 changed files with 12 additions and 17 deletions

View File

@@ -73,11 +73,6 @@ ccflags-y += -DEXPECTED_NEXT_HASH=\"$(KSU_NEXT_EXPECTED_HASH)\"
ifeq ($(shell grep -q "int path_umount" $(srctree)/fs/namespace.c; echo $$?),0)
ccflags-y += -DKSU_UMOUNT
else
$(info -- Did you know you can backport path_umount to fs/namespace.c from 5.9?)
$(info -- Read: https://kernelsu.org/guide/how-to-integrate-for-non-gki.html#how-to-backport-path-umount)
endif
ccflags-y += -Wno-implicit-function-declaration -Wno-strict-prototypes -Wno-int-conversion -Wno-gcc-compat
ccflags-y += -Wno-declaration-after-statement -Wno-unused-function

View File

@@ -450,14 +450,12 @@ static bool should_umount(struct path *path)
return false;
}
static int ksu_umount_mnt(struct path *path, int flags)
static void ksu_umount_mnt(struct path *path, int flags)
{
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 9, 0) || defined(KSU_UMOUNT)
return path_umount(path, flags);
#else
// TODO: umount for non GKI kernel
return -ENOSYS;
#endif
int err = path_umount(path, flags);
if (err) {
pr_info("umount %s failed: %d\n", path->dentry->d_iname, err);
}
}
static void try_umount(const char *mnt, bool check_mnt, int flags)
@@ -477,11 +475,13 @@ static void try_umount(const char *mnt, bool check_mnt, int flags)
if (check_mnt && !should_umount(&path)) {
return;
}
err = ksu_umount_mnt(&path, flags);
if (err) {
pr_warn("umount %s failed: %d\n", mnt, err);
}
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 9, 0) || defined(KSU_UMOUNT)
ksu_umount_mnt(&path, flags);
#else
#error You should backport path_umount to fs/namespace.c !
#error Read: https://kernelsu.org/guide/how-to-integrate-for-non-gki.html#how-to-backport-path-umount
#error Read: https://github.com/tiann/KernelSU/pull/1464
#endif
}
int ksu_handle_setuid(struct cred *new, const struct cred *old)