From: Pasha Tatashin <pasha.tatashin@soleen.com>
To: pasha.tatashin@soleen.com, akpm@linux-foundation.org,
corbet@lwn.net, linux-mm@kvack.org, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org, rick.p.edgecombe@intel.com
Subject: [PATCH v2 3/3] mm/page_table_check: Check writable zero page in page table check
Date: Sat, 22 Jul 2023 23:15:08 +0000 [thread overview]
Message-ID: <20230722231508.1030269-4-pasha.tatashin@soleen.com> (raw)
In-Reply-To: <20230722231508.1030269-1-pasha.tatashin@soleen.com>
From: Rick Edgecombe <rick.p.edgecombe@intel.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@intel.com>
Signed-off-by: Pasha Tatashin <pasha.tatashin@soleen.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
prev parent reply other threads:[~2023-07-22 23:15 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-22 23:15 [PATCH v2 0/3] page table check warn instead of panic Pasha Tatashin
2023-07-22 23:15 ` [PATCH v2 1/3] mm/page_table_check: Do WARN_ON instead of BUG_ON Pasha Tatashin
2023-07-23 1:56 ` Matthew Wilcox
2023-07-23 3:35 ` Pasha Tatashin
2023-07-22 23:15 ` [PATCH v2 2/3] doc/vm: add information about page_table_check warn_on behavior Pasha Tatashin
2023-07-22 23:59 ` Randy Dunlap
2023-07-23 3:37 ` Pasha Tatashin
2023-07-22 23:15 ` Pasha Tatashin [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230722231508.1030269-4-pasha.tatashin@soleen.com \
--to=pasha.tatashin@soleen.com \
--cc=akpm@linux-foundation.org \
--cc=corbet@lwn.net \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=rick.p.edgecombe@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox