Skip to content

Commit ffc6d4c

Browse files
rsuntkluyanci
authored andcommitted
kernel: kernel_compat: Remove inline get_cred_rcu
Since commit: kernel: core_hook: switch to prepare_creds (c58e102) get_cred_rcu is no longer needed. Signed-off-by: rsuntk <[email protected]>
1 parent 14af670 commit ffc6d4c

File tree

2 files changed

+0
-33
lines changed

2 files changed

+0
-33
lines changed

kernel/Makefile

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,6 @@ ifeq ($(shell grep -q "struct selinux_state " $(srctree)/security/selinux/includ
4545
ccflags-y += -DKSU_COMPAT_HAS_SELINUX_STATE
4646
endif
4747

48-
# This feature was introduced in linux 5.0-rc1
49-
ifeq ($(shell grep -q "get_cred_rcu" $(srctree)/include/linux/cred.h; echo $$?),0)
50-
ccflags-y += -DKSU_COMPAT_HAS_GET_CRED_RCU
51-
else
52-
ifeq ($(shell grep -q "atomic_long_t\s\+usage" $(srctree)/include/linux/cred.h; echo $$?),0)
53-
ccflags-y += -DKSU_COMPAT_ATOMIC_LONG
54-
endif
55-
ifeq ($(shell grep -q "int\s\+non_rcu" $(srctree)/include/linux/cred.h; echo $$?),0)
56-
ccflags-y += -DKSU_COMPAT_HAS_NONCONST_CRED
57-
endif
58-
endif
59-
6048
# Handle optional backports
6149
ifeq ($(shell grep -q "strncpy_from_user_nofault" $(srctree)/include/linux/uaccess.h; echo $$?),0)
6250
ccflags-y += -DKSU_OPTIONAL_STRNCPY

kernel/kernel_compat.h

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,6 @@
77
#include "ss/policydb.h"
88
#include "linux/key.h"
99

10-
// for kernel without get_cred_rcu
11-
#ifndef KSU_COMPAT_HAS_GET_CRED_RCU
12-
static inline const struct cred *get_cred_rcu(const struct cred *cred)
13-
{
14-
struct cred *nonconst_cred = (struct cred *) cred;
15-
if (!cred)
16-
return NULL;
17-
#ifdef KSU_COMPAT_ATOMIC_LONG
18-
if (!atomic_long_inc_not_zero(&nonconst_cred->usage))
19-
#else
20-
if (!atomic_inc_not_zero(&nonconst_cred->usage))
21-
#endif
22-
return NULL;
23-
validate_creds(cred);
24-
#ifdef KSU_COMPAT_HAS_NONCONST_CRED
25-
nonconst_cred->non_rcu = 0;
26-
#endif
27-
return cred;
28-
}
29-
#endif
30-
3110
/*
3211
* Adapt to Huawei HISI kernel without affecting other kernels ,
3312
* Huawei Hisi Kernel EBITMAP Enable or Disable Flag ,

0 commit comments

Comments
 (0)