[Devel] [PATCH RHEL COMMIT] mm: Do not leak node data to CT's /proc/vmstat

Konstantin Khorenko khorenko at virtuozzo.com
Thu Sep 30 17:44:07 MSK 2021


The commit is pushed to "branch-rh9-5.14.vz9.1.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after ark-5.14
------>
commit 92dc7e022cab72f6da6d23fd59e822038ab70325
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Thu Sep 30 17:44:07 2021 +0300

    mm: Do not leak node data to CT's /proc/vmstat
    
    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;


More information about the Devel mailing list