Skip to content

Commit

Permalink
kernel: require path_umount backporting
Browse files Browse the repository at this point in the history
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.

References:
	tiann#1464
	tiann@b4cfc2f

Signed-off-by: backslashxx <118538522+backslashxx@users.noreply.github.com>
  • Loading branch information
backslashxx authored and selfmusing committed Dec 25, 2024
1 parent 0fea306 commit 840c7de
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 0 additions & 3 deletions kernel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,6 @@ ccflags-y += -DEXPECTED_HASH=\"$(KSU_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
Expand Down
7 changes: 6 additions & 1 deletion kernel/core_hook.c
Original file line number Diff line number Diff line change
Expand Up @@ -475,8 +475,13 @@ static void try_umount(const char *mnt, bool check_mnt, int flags)
if (check_mnt && !should_umount(&path)) {
return;
}

#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)
Expand Down

0 comments on commit 840c7de

Please sign in to comment.