The branch main has been updated by markj:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=52bf6257c2aac19788636e525b139ec57a38fb1c

commit 52bf6257c2aac19788636e525b139ec57a38fb1c
Author:     Mark Johnston <ma...@freebsd.org>
AuthorDate: 2024-02-08 15:56:58 +0000
Commit:     Mark Johnston <ma...@freebsd.org>
CommitDate: 2024-02-08 16:35:11 +0000

    arm64: Define shadow maps for KMSAN
    
    Both are the same size as the kernel map.
    
    Reviewed by:    imp
    MFC after:      2 weeks
    Sponsored by:   Klara, Inc.
    Sponsored by:   Juniper Networks, Inc.
    Differential Revision:  https://reviews.freebsd.org/D43154
---
 sys/arm64/arm64/pmap.c      |  6 ++++++
 sys/arm64/include/vmparam.h | 14 ++++++++++++++
 2 files changed, 20 insertions(+)

diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c
index 58c21f9d2c30..7c7a9a08fd30 100644
--- a/sys/arm64/arm64/pmap.c
+++ b/sys/arm64/arm64/pmap.c
@@ -8175,6 +8175,12 @@ sysctl_kmaps(SYSCTL_HANDLER_ARGS)
                else if (i == pmap_l0_index(KASAN_MIN_ADDRESS))
                        sbuf_printf(sb, "\nKASAN shadow map:\n");
 #endif
+#ifdef KMSAN
+               else if (i == pmap_l0_index(KMSAN_SHAD_MIN_ADDRESS))
+                       sbuf_printf(sb, "\nKMSAN shadow map:\n");
+               else if (i == pmap_l0_index(KMSAN_ORIG_MIN_ADDRESS))
+                       sbuf_printf(sb, "\nKMSAN origin map:\n");
+#endif
 
                l0e = kernel_pmap->pm_l0[i];
                if ((l0e & ATTR_DESCR_VALID) == 0) {
diff --git a/sys/arm64/include/vmparam.h b/sys/arm64/include/vmparam.h
index d577b9315471..0967d3c0aedf 100644
--- a/sys/arm64/include/vmparam.h
+++ b/sys/arm64/include/vmparam.h
@@ -131,6 +131,12 @@
  *                  0xfffffeffffffffff  End of DMAP
  *                  0xffffa00000000000  Start of DMAP
  *
+ *                  0xffff027fffffffff  End of KMSAN origin map
+ *                  0xffff020000000000  Start of KMSAN origin map
+ *
+ *                  0xffff017fffffffff  End of KMSAN shadow map
+ *                  0xffff010000000000  Start of KMSAN shadow map
+ *
  *                  0xffff009fffffffff  End of KASAN shadow map
  *                  0xffff008000000000  Start of KASAN shadow map
  *
@@ -167,6 +173,14 @@
 #define        KASAN_MIN_ADDRESS       (0xffff008000000000UL)
 #define        KASAN_MAX_ADDRESS       (0xffff00a000000000UL)
 
+/* 512GiB KMSAN shadow map */
+#define        KMSAN_SHAD_MIN_ADDRESS  (0xffff010000000000UL)
+#define        KMSAN_SHAD_MAX_ADDRESS  (0xffff018000000000UL)
+
+/* 512GiB KMSAN origin map */
+#define        KMSAN_ORIG_MIN_ADDRESS  (0xffff020000000000UL)
+#define        KMSAN_ORIG_MAX_ADDRESS  (0xffff028000000000UL)
+
 /* The address bits that hold a pointer authentication code */
 #define        PAC_ADDR_MASK           (0xff7f000000000000UL)
 

Reply via email to