diff --git a/backport.patch b/backport.patch deleted file mode 100644 index cb83e7d9..00000000 --- a/backport.patch +++ /dev/null @@ -1,78 +0,0 @@ -From 7e1e590523aa892fc225e740cdcba8ec4213f960 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?YC=E9=85=B1luyancib?= -Date: Thu, 27 Feb 2025 18:50:34 +0800 -Subject: [PATCH] Kernel:Add auto backport into the kernel source - -Copy from KSUN - -Co-Authored-By: Rifat Azad <33044977+rifsxd@users.noreply.github.com> ---- - kernel/Makefile | 55 +++++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 55 insertions(+) - -diff --git a/kernel/Makefile b/kernel/Makefile -index 378f60e156af..72dd0333f92c 100644 ---- a/kernel/Makefile -+++ b/kernel/Makefile -@@ -14,6 +14,61 @@ kernelsu-objs += selinux/rules.o - ccflags-y += -I$(srctree)/security/selinux -I$(srctree)/security/selinux/include - ccflags-y += -I$(objtree)/security/selinux -include $(srctree)/include/uapi/asm-generic/errno.h - -+# Determine the appropriate atomic function and apply patch accordingly -+ifeq ($(shell grep -q "atomic_inc_not_zero" $(srctree)/kernel/cred.c; echo $$?),0) -+ATOMIC_INC_FUNC = atomic_inc_not_zero -+else ifeq ($(shell grep -q "atomic_long_inc_not_zero" $(srctree)/kernel/cred.c; echo $$?),0) -+ATOMIC_INC_FUNC = atomic_long_inc_not_zero -+else -+$(info -- Neither atomic_inc_not_zero nor atomic_long_inc_not_zero found in kernel/cred.c) -+endif -+ -+# Inform which function is being patched -+$(info -- Using $(ATOMIC_INC_FUNC) in get_cred_rcu patch.) -+ -+ifneq ($(shell grep -Eq "^static int can_umount" $(srctree)/fs/namespace.c; echo $$?),0) -+$(info -- Adding function 'static int can_umount(const struct path *path, int flags);' to $(srctree)/fs/namespace.c) -+CAN_UMOUNT = static int can_umount(const struct path *path, int flags)\n\ -+{\n\t\ -+ struct mount *mnt = real_mount(path->mnt);\n\t\ -+ if (flags & ~(MNT_FORCE | MNT_DETACH | MNT_EXPIRE | UMOUNT_NOFOLLOW))\n\t\t\ -+ return -EINVAL;\n\t\ -+ if (!may_mount())\n\t\t\ -+ return -EPERM;\n\t\ -+ if (path->dentry != path->mnt->mnt_root)\n\t\t\ -+ return -EINVAL;\n\t\ -+ if (!check_mnt(mnt))\n\t\t\ -+ return -EINVAL;\n\t\ -+ if (mnt->mnt.mnt_flags & MNT_LOCKED)\n\t\t\ -+ return -EINVAL;\n\t\ -+ if (flags & MNT_FORCE && !capable(CAP_SYS_ADMIN))\n\t\t\ -+ return -EPERM;\n\t\ -+ return 0;\n\ -+}\n -+$(shell sed -i '/^static bool is_mnt_ns_file/i $(CAN_UMOUNT)' $(srctree)/fs/namespace.c;) -+endif -+ -+ifneq ($(shell grep -Eq "^int path_umount" $(srctree)/fs/namespace.c; echo $$?),0) -+$(info -- Adding function 'int path_umount(struct path *path, int flags);' to $(srctree)/fs/namespace.c) -+PATH_UMOUNT = int path_umount(struct path *path, int flags)\n\ -+{\n\t\ -+ struct mount *mnt = real_mount(path->mnt);\n\t\ -+ int ret;\n\t\ -+ ret = can_umount(path, flags);\n\t\ -+ if (!ret)\n\t\t\ -+ ret = do_umount(mnt, flags);\n\t\ -+ dput(path->dentry);\n\t\ -+ mntput_no_expire(mnt);\n\t\ -+ return ret;\n\ -+}\n -+$(shell sed -i '/^static bool is_mnt_ns_file/i $(PATH_UMOUNT)' $(srctree)/fs/namespace.c;) -+endif -+ -+ifneq ($(shell grep -Eq "^int path_umount" $(srctree)/fs/internal.h; echo $$?),0) -+$(shell sed -i '/^extern void __init mnt_init/a int path_umount(struct path *path, int flags);' $(srctree)/fs/internal.h;) -+$(info -- Adding 'int path_umount(struct path *path, int flags);' to $(srctree)/fs/internal.h) -+endif -+ - # Do checks before compile - ifneq ($(shell grep -q "int path_umount" $(srctree)/fs/namespace.c; echo $$?),0) - $(error -- Backporting path_umount is mandatory !! Read: https://kernelsu.org/guide/how-to-integrate-for-non-gki.html#how-to-backport-path-umount)