diff --git a/kernel/Makefile b/kernel/Makefile index 729fabdc..0206cec4 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -134,49 +134,6 @@ ccflags-y += -DSAMSUNG_UH_DRIVER_EXIST endif ccflags-y += -DKSU_UMOUNT -ccflags-y += -DKSU_COMPAT_GET_CRED_RCU - -# Add the get_cred_rcu function to cred.h if not already present -ifneq ($(shell grep -Eq "^static inline const struct cred \*get_cred_rcu" $(srctree)/include/linux/cred.h; echo $$?),0) -$(info -- SukiSU compat: adding function 'static inline const struct cred *get_cred_rcu(const struct cred *cred);' to $(srctree)/include/linux/cred.h) -GET_CRED_RCU = static inline const struct cred *get_cred_rcu(const struct cred *cred)\n\ -{\n\t\ - struct cred *nonconst_cred = (struct cred *) cred;\n\t\ - if (!cred)\n\t\t\ - return NULL;\n\t\ - if (!$(ATOMIC_INC_FUNC)(&nonconst_cred->usage))\n\t\t\ - return NULL;\n\t\ - validate_creds(cred);\n\t\ - return cred;\n\ -}\n -$(shell grep -qF "$(GET_CRED_RCU)" $(srctree)/include/linux/cred.h || sed -i '/^static inline void put_cred/i $(GET_CRED_RCU)' $(srctree)/include/linux/cred.h) - -# Modify get_task_cred in cred.c -$(info -- SukiSU compat: modifying 'get_task_cred' function in $(srctree)/kernel/cred.c) -$(shell sed -i "s/!$(ATOMIC_INC_FUNC)(&((struct cred \*)cred)->usage)/!get_cred_rcu(cred)/g" $(srctree)/kernel/cred.c) -endif - -ifneq ($(shell grep -Eq "^static int can_umount" $(srctree)/fs/namespace.c; echo $$?),0) -$(info -- SukiSU compat: 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 -- SukiSU compat: adding function 'int path_umount(struct path *path, int flags);' to $(srctree)/fs/namespace.c)