[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220223052223.1202152-22-junaids@google.com>
Date: Tue, 22 Feb 2022 21:21:57 -0800
From: Junaid Shahid <junaids@...gle.com>
To: linux-kernel@...r.kernel.org
Cc: kvm@...r.kernel.org, pbonzini@...hat.com, jmattson@...gle.com,
pjt@...gle.com, oweisse@...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 21/47] mm: asi: Add support for locally non-sensitive
VM_USERMAP pages
VM_USERMAP pages can be mapped into userspace, which would overwrite
the asi_mm field, so we restore that field when freeing these pages.
Signed-off-by: Junaid Shahid <junaids@...gle.com>
---
mm/vmalloc.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index ea94d8a1e2e9..a89866a926f6 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -2424,6 +2424,14 @@ static void asi_unmap_vm_area(struct vm_struct *area)
*/
if (area->flags & (VM_GLOBAL_NONSENSITIVE | VM_LOCAL_NONSENSITIVE))
asi_unmap(area->asi, area->addr, get_vm_area_size(area), true);
+
+ if (area->flags & VM_USERMAP) {
+ uint i;
+
+ for (i = 0; i < area->nr_pages; i++)
+ if (PageLocalNonSensitive(area->pages[i]))
+ area->pages[i]->asi_mm = area->asi->mm;
+ }
}
#else
--
2.35.1.473.g83b2b277ed-goog
Powered by blists - more mailing lists