[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230722231508.1030269-4-pasha.tatashin@soleen.com>
Date: Sat, 22 Jul 2023 23:15:08 +0000
From: Pasha Tatashin <pasha.tatashin@...een.com>
To: pasha.tatashin@...een.com, akpm@...ux-foundation.org,
corbet@....net, linux-mm@...ck.org, linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org, rick.p.edgecombe@...el.com
Subject: [PATCH v2 3/3] mm/page_table_check: Check writable zero page in page table check
From: Rick Edgecombe <rick.p.edgecombe@...el.com>
The zero page should remain all zero, so that it can be mapped as
read-only for read faults of memory that should be zeroed. If it is ever
mapped writable to userspace, it could become non-zero and so other apps
would unexpectedly get non-zero data. So the zero page should never be
mapped writable to userspace. Check for this condition in
page_table_check_set().
Signed-off-by: Rick Edgecombe <rick.p.edgecombe@...el.com>
Signed-off-by: Pasha Tatashin <pasha.tatashin@...een.com>
---
mm/page_table_check.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/mm/page_table_check.c b/mm/page_table_check.c
index ad4447e999f8..db1ed36f7203 100644
--- a/mm/page_table_check.c
+++ b/mm/page_table_check.c
@@ -114,6 +114,8 @@ static void page_table_check_set(struct mm_struct *mm, unsigned long addr,
if (!pfn_valid(pfn))
return;
+ PAGE_TABLE_CHECK_WARN(is_zero_pfn(pfn) && rw);
+
page = pfn_to_page(pfn);
page_ext = page_ext_get(page);
--
2.41.0.487.g6d72f3e995-goog
Powered by blists - more mailing lists