From 55c09c9b96eb6f4c0c75790c4c53eb4e1501a356 Mon Sep 17 00:00:00 2001 From: Preeti Nagar Date: Mon, 8 Jun 2020 15:35:33 +0530 Subject: [PATCH] RTIC: Move selinux_state to a separate 4k We need to relocate selinux_state to a separate 4k page to enable EL2 Hypervisor to monitor changes to this variable using ARM stage 2 MMU. We will avoid getting page faults from un-related data as the MMU granularity is configured to 4k. Change-Id: I7d0e5c9eae0a2a65ca9db73e85283e164e20c11c Signed-off-by: Preeti Nagar --- arch/arm64/kernel/vmlinux.lds.S | 9 +++++++++ include/linux/init.h | 4 ++++ security/selinux/hooks.c | 4 ++++ 3 files changed, 17 insertions(+) diff --git a/arch/arm64/kernel/vmlinux.lds.S b/arch/arm64/kernel/vmlinux.lds.S index aa76f7259668..75d3f8cac12d 100644 --- a/arch/arm64/kernel/vmlinux.lds.S +++ b/arch/arm64/kernel/vmlinux.lds.S @@ -5,6 +5,15 @@ * Written by Martin Mares */ +#ifdef CONFIG_QCOM_RTIC +#define BSS_FIRST_SECTIONS \ + . = ALIGN(PAGE_SIZE); \ + KEEP(*(.bss.rtic)) \ + . = ALIGN(PAGE_SIZE); +#else +#define BSS_FIRST_SECTIONS +#endif + #include #include #include diff --git a/include/linux/init.h b/include/linux/init.h index 32633ea36f96..48a27e630e8e 100644 --- a/include/linux/init.h +++ b/include/linux/init.h @@ -322,6 +322,10 @@ void __init parse_early_options(char *cmdline); /* Data marked not to be saved by software suspend */ #define __nosavedata __section(.data..nosave) +#ifdef CONFIG_QCOM_RTIC +#define __rticdata __section(.bss.rtic) +#endif + #ifdef MODULE #define __exit_p(x) x #else diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index f8a9b2a3ad67..42ee176bf198 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c @@ -103,7 +103,11 @@ #include "audit.h" #include "avc_ss.h" +#ifdef CONFIG_QCOM_RTIC +struct selinux_state selinux_state __rticdata; +#else struct selinux_state selinux_state; +#endif /* SECMARK reference count */ static atomic_t selinux_secmark_refcount = ATOMIC_INIT(0);