kernel: Fix compatibility with nongki kernels (#594)

This commit is contained in:
YangQi0408
2025-11-18 00:25:48 +08:00
committed by GitHub
parent c4faf57ca9
commit fb539fae57
5 changed files with 36 additions and 6 deletions

View File

@@ -106,7 +106,11 @@ bool is_task_ksu_domain(const struct cred* cred)
if (!cred) {
return false;
}
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,1,0)
const struct task_security_struct *tsec = selinux_cred(cred);
#else
const struct task_security_struct *tsec = cred->security;
#endif
if (!tsec) {
return false;
}
@@ -130,7 +134,11 @@ bool is_context(const struct cred* cred, const char* context)
if (!cred) {
return false;
}
const struct task_security_struct * tsec = selinux_cred(cred);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,1,0)
const struct task_security_struct *tsec = selinux_cred(cred);
#else
const struct task_security_struct *tsec = cred->security;
#endif
if (!tsec) {
return false;
}