-
Notifications
You must be signed in to change notification settings - Fork 3
/
ksu_fix.patch
57 lines (53 loc) · 2.07 KB
/
ksu_fix.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
diff --git a/kernel/core_hook.c b/kernel/core_hook.c
index 3ab88f57..53039655 100644
--- a/kernel/core_hook.c
+++ b/kernel/core_hook.c
@@ -637,7 +637,7 @@ static int ksu_task_prctl(int option, unsigned long arg2, unsigned long arg3,
return -ENOSYS;
}
// kernel 4.4 and 4.9
-#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
static int ksu_key_permission(key_ref_t key_ref, const struct cred *cred,
unsigned perm)
{
@@ -669,7 +669,7 @@ static struct security_hook_list ksu_hooks[] = {
LSM_HOOK_INIT(task_prctl, ksu_task_prctl),
LSM_HOOK_INIT(inode_rename, ksu_inode_rename),
LSM_HOOK_INIT(task_fix_setuid, ksu_task_fix_setuid),
-#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
LSM_HOOK_INIT(key_permission, ksu_key_permission)
#endif
};
diff --git a/kernel/kernel_compat.c b/kernel/kernel_compat.c
index 3e216657..c542c6b3 100644
--- a/kernel/kernel_compat.c
+++ b/kernel/kernel_compat.c
@@ -12,7 +12,7 @@
#endif
#include "klog.h" // IWYU pragma: keep
-#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
#include "linux/key.h"
#include "linux/errno.h"
#include "linux/cred.h"
@@ -81,7 +81,7 @@ void ksu_android_ns_fs_check()
struct file *ksu_filp_open_compat(const char *filename, int flags, umode_t mode)
{
-#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
if (init_session_keyring != NULL && !current_cred()->session_keyring &&
(current->flags & PF_WQ_WORKER)) {
pr_info("installing init session keyring for older kernel\n");
diff --git a/kernel/kernel_compat.h b/kernel/kernel_compat.h
index f97080d4..abcde7f1 100644
--- a/kernel/kernel_compat.h
+++ b/kernel/kernel_compat.h
@@ -9,7 +9,7 @@ extern long ksu_strncpy_from_user_nofault(char *dst,
const void __user *unsafe_addr,
long count);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
extern struct key *init_session_keyring;
#endif