From 3a555cabc36531a3629cbddd88de86323954364a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=9B=A2=E8=BE=89?= Date: Thu, 12 Sep 2024 18:25:54 +0800 Subject: [PATCH] =?UTF-8?q?xpm=E6=A8=A1=E5=9D=97=E9=80=82=E9=85=8Dlinux6.6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 团辉 --- xpm/core/xpm_security_hooks.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/xpm/core/xpm_security_hooks.c b/xpm/core/xpm_security_hooks.c index 5fe5b37..bb60507 100644 --- a/xpm/core/xpm_security_hooks.c +++ b/xpm/core/xpm_security_hooks.c @@ -5,6 +5,7 @@ #include #include +#include #include "avc.h" #include "objsec.h" @@ -182,8 +183,13 @@ static int xpm_avc_has_perm(u16 tclass, u32 requested) struct av_decision avd; u32 sid = current_sid(); +#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0)) return avc_has_perm_noaudit(&selinux_state, sid, sid, tclass, requested, AVC_STRICT, &avd); +#else + return avc_has_perm_noaudit(sid, sid, tclass, requested, + AVC_STRICT, &avd); +#endif } static int xpm_validate_signature(struct vm_area_struct *vma, @@ -361,7 +367,7 @@ static int xpm_mprotect_check(struct vm_area_struct *vma, return xpm_common_check(vma, prot); } -static struct security_hook_list xpm_hooks[] __lsm_ro_after_init = { +static struct security_hook_list xpm_hooks[] __ro_after_init = { LSM_HOOK_INIT(mmap_region, xpm_mmap_check), LSM_HOOK_INIT(file_mprotect, xpm_mprotect_check), }; -- Gitee