lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220223052223.1202152-38-junaids@google.com>
Date:   Tue, 22 Feb 2022 21:22:13 -0800
From:   Junaid Shahid <junaids@...gle.com>
To:     linux-kernel@...r.kernel.org
Cc:     Ofir Weisse <oweisse@...gle.com>, kvm@...r.kernel.org,
        pbonzini@...hat.com, jmattson@...gle.com, pjt@...gle.com,
        alexandre.chartre@...cle.com, rppt@...ux.ibm.com,
        dave.hansen@...ux.intel.com, peterz@...radead.org,
        tglx@...utronix.de, luto@...nel.org, linux-mm@...ck.org
Subject: [RFC PATCH 37/47] mm: asi: ASI annotation support for static variables.

From: Ofir Weisse <oweisse@...gle.com>

Added the following annotations:

__asi_not_sensitive: for static variables which are considered not
sensitive.

__asi_not_sensitive_readmostly: similar to __read_mostly, for
non-sensitive static variables.

Signed-off-by: Ofir Weisse <oweisse@...gle.com>


---
 arch/x86/include/asm/asi.h        | 12 ++++++++++++
 include/asm-generic/asi.h         |  6 ++++++
 include/asm-generic/vmlinux.lds.h | 18 +++++++++++++++++-
 3 files changed, 35 insertions(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/asi.h b/arch/x86/include/asm/asi.h
index bdb2f70d4f85..6dd9c7c8a2b8 100644
--- a/arch/x86/include/asm/asi.h
+++ b/arch/x86/include/asm/asi.h
@@ -177,6 +177,18 @@ static inline pgd_t *asi_pgd(struct asi *asi)
 	return asi->pgd;
 }
 
+/* IMPORTANT: Any modification to the name here should also be applied to
+ * include/asm-generic/vmlinux.lds.h */
+#define ASI_NON_SENSITIVE_SECTION_NAME ".data..asi_non_sensitive"
+#define ASI_NON_SENSITIVE_READ_MOSTLY_SECTION_NAME \
+                       ".data..asi_non_sensitive_readmostly"
+
+#define __asi_not_sensitive \
+    __section(ASI_NON_SENSITIVE_SECTION_NAME)
+
+#define __asi_not_sensitive_readmostly \
+    __section(ASI_NON_SENSITIVE_READ_MOSTLY_SECTION_NAME)
+
 #else	/* CONFIG_ADDRESS_SPACE_ISOLATION */
 
 static inline void asi_intr_enter(void) { }
diff --git a/include/asm-generic/asi.h b/include/asm-generic/asi.h
index fffb323d2a00..d9082267a5dd 100644
--- a/include/asm-generic/asi.h
+++ b/include/asm-generic/asi.h
@@ -121,6 +121,12 @@ void asi_flush_tlb_range(struct asi *asi, void *addr, size_t len) { }
 #define static_asi_enabled() false
 
 
+/* IMPORTANT: Any modification to the name here should also be applied to
+ * include/asm-generic/vmlinux.lds.h */
+
+#define __asi_not_sensitive
+#define __asi_not_sensitive_readmostly
+
 #endif  /* !_ASSEMBLY_ */
 
 #endif /* !CONFIG_ADDRESS_SPACE_ISOLATION */
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 42f3866bca69..c769d939c15f 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -374,10 +374,26 @@
 	. = ALIGN(PAGE_SIZE);						\
 	__nosave_end = .;
 
+#ifdef CONFIG_ADDRESS_SPACE_ISOLATION
+#define ASI_NOT_SENSITIVE_DATA(page_align)                              \
+       . = ALIGN(page_align);                                           \
+       __start_asi_nonsensitive = .;                                    \
+       *(.data..asi_non_sensitive)                                      \
+       . = ALIGN(page_align);                                           \
+       __end_asi_nonsensitive = .;                                      \
+       __start_asi_nonsensitive_readmostly = .;                         \
+       *(.data..asi_non_sensitive_readmostly)                           \
+       . = ALIGN(page_align);                                           \
+       __end_asi_nonsensitive_readmostly = .;
+#else
+#define ASI_NOT_SENSITIVE_DATA
+#endif
+
 #define PAGE_ALIGNED_DATA(page_align)					\
 	. = ALIGN(page_align);						\
 	*(.data..page_aligned)						\
-	. = ALIGN(page_align);
+	. = ALIGN(page_align);                                          \
+        ASI_NOT_SENSITIVE_DATA(page_align)
 
 #define READ_MOSTLY_DATA(align)						\
 	. = ALIGN(align);						\
-- 
2.35.1.473.g83b2b277ed-goog

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ