@@ -104,47 +104,24 @@ $(info -- KSU_NEXT: modifying 'get_task_cred' function in $(srctree)/kernel/cred
104
104
$(shell sed -i "s/!$(ATOMIC_INC_FUNC)(&((struct cred \*)cred)->usage)/!get_cred_rcu(cred)/g" $(srctree)/kernel/cred.c)
105
105
endif
106
106
107
- ifneq ($(shell grep -Eq "^static int can_umount" $(srctree ) /fs/namespace.c; echo $$? ) ,0)
108
- $(info -- KSU_NEXT : adding function 'static int can_umount(const struct path * path, int flags);' to $(srctree ) /fs/namespace.c)
109
- CAN_UMOUNT = static int can_umount(const struct path *path, int flags)\n\
110
- {\n\t\
111
- struct mount *mnt = real_mount(path->mnt);\n\t\
112
- if (flags & ~(MNT_FORCE | MNT_DETACH | MNT_EXPIRE | UMOUNT_NOFOLLOW))\n\t\t\
113
- return -EINVAL;\n\t\
114
- if (!may_mount())\n\t\t\
115
- return -EPERM;\n\t\
116
- if (path->dentry != path->mnt->mnt_root)\n\t\t\
117
- return -EINVAL;\n\t\
118
- if (!check_mnt(mnt))\n\t\t\
119
- return -EINVAL;\n\t\
120
- if (mnt->mnt.mnt_flags & MNT_LOCKED)\n\t\t\
121
- return -EINVAL;\n\t\
122
- if (flags & MNT_FORCE && !capable(CAP_SYS_ADMIN))\n\t\t\
123
- return -EPERM;\n\t\
124
- return 0;\n\
125
- }\n
126
- $(shell sed -i '/^static bool is_mnt_ns_file/i $(CAN_UMOUNT)' $(srctree)/fs/namespace.c;)
107
+ ifeq ($(shell grep -q "int path_umount" $(srctree ) /fs/namespace.c; echo $$? ) ,0)
108
+ $(info -- KernelSU/compat : path_umount found)
109
+ ccflags-y += -DKSU_HAS_PATH_UMOUNT
127
110
endif
128
111
129
- ifneq ($(shell grep -Eq "^int path_umount" $(srctree ) /fs/namespace.c; echo $$? ) ,0)
130
- $(info -- KSU_NEXT : adding function 'int path_umount(struct path * path, int flags);' to $(srctree ) /fs/namespace.c)
131
- PATH_UMOUNT = int path_umount(struct path *path, int flags)\n\
132
- {\n\t\
133
- struct mount *mnt = real_mount(path->mnt);\n\t\
134
- int ret;\n\t\
135
- ret = can_umount(path, flags);\n\t\
136
- if (!ret)\n\t\t\
137
- ret = do_umount(mnt, flags);\n\t\
138
- dput(path->dentry);\n\t\
139
- mntput_no_expire(mnt);\n\t\
140
- return ret;\n\
141
- }\n
142
- $(shell sed -i '/^static bool is_mnt_ns_file/i $(PATH_UMOUNT)' $(srctree)/fs/namespace.c;)
112
+ ifeq ($(shell grep -q "strncpy_from_unsafe_user" $(srctree ) /include/linux/uaccess.h; echo $$? ) ,0)
113
+ $(info -- KernelSU/compat : strncpy_from_unsafe_user found)
114
+ ccflags-y += -DKSU_STRNCPY_FROM_UNSAFE_USER
143
115
endif
144
116
145
- ifneq ($(shell grep -Eq "^int path_umount" $(srctree ) /fs/internal.h; echo $$? ) ,0)
146
- $(shell sed -i '/^extern void __init mnt_init/a int path_umount(struct path *path, int flags);' $(srctree)/fs/internal.h;)
147
- $(info -- KSU_NEXT : adding 'int path_umount(struct path * path, int flags);' to $(srctree ) /fs/internal.h)
117
+ ifeq ($(shell grep -q "ssize_t kernel_read" $(srctree ) /fs/read_write.c; echo $$? ) ,0)
118
+ $(info -- KernelSU/compat : newer kernel_read found)
119
+ ccflags-y += -DKSU_NEW_KERNEL_READ
120
+ endif
121
+
122
+ ifeq ($(shell grep "ssize_t kernel_write" $(srctree ) /fs/read_write.c | grep -q "const void" ; echo $$? ) ,0)
123
+ $(info -- KernelSU/compat : newer kernel_write found)
124
+ ccflags-y += -DKSU_NEW_KERNEL_WRITE
148
125
endif
149
126
150
127
ccflags-y += -Wno-implicit-function-declaration -Wno-strict-prototypes -Wno-int-conversion -Wno-gcc-compat
0 commit comments