[PATCH 13/26] mm/init-mm: Annotate static information into meminspect

Eugen Hristev
2025-11-19T15:45:41Z

Annotate vital static information into inspection table:
- init_mm
- swapper_pg_dir
- _sinittext
- _einittext
- _end
- _text
- _stext
- _etext

Information on these variables is stored into dedicated inspection section.

Signed-off-by: Eugen Hristev <eugen.hristev@linaro.org>
---
mm/init-mm.c | 11 +++++++++++
1 file changed, 11 insertions(+)

diff --git a/mm/init-mm.c b/mm/init-mm.c
index 4600e7605cab..6931549bb7a2 100644
--- a/mm/init-mm.c
+++ b/mm/init-mm.c
@@ -7,6 +7,7 @@
#include <linux/cpumask.h>
#include <linux/mman.h>
#include <linux/pgtable.h>
+#include <linux/meminspect.h>

#include <linux/atomic.h>
#include <linux/user_namespace.h>
@@ -19,6 +20,13 @@

const struct vm_operations_struct vma_dummy_vm_ops;

+MEMINSPECT_AREA_ENTRY(_sinittext, sizeof(void *));
+MEMINSPECT_AREA_ENTRY(_einittext, sizeof(void *));
+MEMINSPECT_AREA_ENTRY(_end, sizeof(void *));
+MEMINSPECT_AREA_ENTRY(_text, sizeof(void *));
+MEMINSPECT_AREA_ENTRY(_stext, sizeof(void *));
+MEMINSPECT_AREA_ENTRY(_etext, sizeof(void *));
+
/*
* For dynamically allocated mm_structs, there is a dynamically sized cpumask
* at the end of the structure, the size of which depends on the maximum CPU
@@ -48,6 +56,9 @@ struct mm_struct init_mm = {
INIT_MM_CONTEXT(init_mm)
};

+MEMINSPECT_SIMPLE_ENTRY(init_mm);
+MEMINSPECT_AREA_ENTRY(swapper_pg_dir, sizeof(void *));
+
void setup_initial_init_mm(void *start_code, void *end_code,
void *end_data, void *brk)
{
--
2.43.0