[Devel] [PATCH vz9 15/16] mm: Do not leak node data to CT's /proc/vmstat

Nikita Yushchenko nikita.yushchenko at virtuozzo.com
Wed Sep 29 10:00:16 MSK 2021


From: Kirill Tkhai <ktkhai at virtuozzo.com>

Extracted from "Initial patch".

Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>

(cherry-picked from vz8 commit 9f9072abf5e1 ("mm: Do not leak node
data to CT's /proc/vmstat"))

Signed-off-by: Nikita Yushchenko <nikita.yushchenko at virtuozzo.com>
---
 mm/vmstat.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/mm/vmstat.c b/mm/vmstat.c
index 0ed75620f8f2..30436a098821 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -1722,6 +1722,12 @@ static void *vmstat_start(struct seq_file *m, loff_t *pos)
 	m->private = v;
 	if (!v)
 		return ERR_PTR(-ENOMEM);
+
+	if (!ve_is_super(get_exec_env())) {
+		memset(v, 0, NR_VMSTAT_ITEMS * sizeof(unsigned long));
+		return (unsigned long *)m->private + *pos;
+	}
+
 	for (i = 0; i < NR_VM_ZONE_STAT_ITEMS; i++)
 		v[i] = global_zone_page_state(i);
 	v += NR_VM_ZONE_STAT_ITEMS;
-- 
2.30.2



More information about the Devel mailing list