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 <90097027+rsuntk@users.noreply.github.com>
This commit is contained in:
@@ -48,18 +48,6 @@ ifeq ($(shell grep -q "struct selinux_state " $(srctree)/security/selinux/includ
|
|||||||
ccflags-y += -DKSU_COMPAT_HAS_SELINUX_STATE
|
ccflags-y += -DKSU_COMPAT_HAS_SELINUX_STATE
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# This feature was introduced in linux 5.0-rc1
|
|
||||||
ifeq ($(shell grep -q "get_cred_rcu" $(srctree)/include/linux/cred.h; echo $$?),0)
|
|
||||||
ccflags-y += -DKSU_COMPAT_HAS_GET_CRED_RCU
|
|
||||||
else
|
|
||||||
ifeq ($(shell grep -q "atomic_long_t\s\+usage" $(srctree)/include/linux/cred.h; echo $$?),0)
|
|
||||||
ccflags-y += -DKSU_COMPAT_ATOMIC_LONG
|
|
||||||
endif
|
|
||||||
ifeq ($(shell grep -q "int\s\+non_rcu" $(srctree)/include/linux/cred.h; echo $$?),0)
|
|
||||||
ccflags-y += -DKSU_COMPAT_HAS_NONCONST_CRED
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Handle optional backports
|
# Handle optional backports
|
||||||
ifeq ($(shell grep -q "strncpy_from_user_nofault" $(srctree)/include/linux/uaccess.h; echo $$?),0)
|
ifeq ($(shell grep -q "strncpy_from_user_nofault" $(srctree)/include/linux/uaccess.h; echo $$?),0)
|
||||||
ccflags-y += -DKSU_OPTIONAL_STRNCPY
|
ccflags-y += -DKSU_OPTIONAL_STRNCPY
|
||||||
|
|||||||
@@ -7,27 +7,6 @@
|
|||||||
#include "ss/policydb.h"
|
#include "ss/policydb.h"
|
||||||
#include "linux/key.h"
|
#include "linux/key.h"
|
||||||
|
|
||||||
// for kernel without get_cred_rcu
|
|
||||||
#ifndef KSU_COMPAT_HAS_GET_CRED_RCU
|
|
||||||
static inline const struct cred *get_cred_rcu(const struct cred *cred)
|
|
||||||
{
|
|
||||||
struct cred *nonconst_cred = (struct cred *) cred;
|
|
||||||
if (!cred)
|
|
||||||
return NULL;
|
|
||||||
#ifdef KSU_COMPAT_ATOMIC_LONG
|
|
||||||
if (!atomic_long_inc_not_zero(&nonconst_cred->usage))
|
|
||||||
#else
|
|
||||||
if (!atomic_inc_not_zero(&nonconst_cred->usage))
|
|
||||||
#endif
|
|
||||||
return NULL;
|
|
||||||
validate_creds(cred);
|
|
||||||
#ifdef KSU_COMPAT_HAS_NONCONST_CRED
|
|
||||||
nonconst_cred->non_rcu = 0;
|
|
||||||
#endif
|
|
||||||
return cred;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Adapt to Huawei HISI kernel without affecting other kernels ,
|
* Adapt to Huawei HISI kernel without affecting other kernels ,
|
||||||
* Huawei Hisi Kernel EBITMAP Enable or Disable Flag ,
|
* Huawei Hisi Kernel EBITMAP Enable or Disable Flag ,
|
||||||
|
|||||||
Reference in New Issue
Block a user