linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Pasha Tatashin <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: Re: [PATCH 1/3] mm/page_table_check: Check writable zero page in page table check
Date: Mon, 26 Sep 2022 10:26:52 +0200	[thread overview]
Message-ID: <353188b6-1fa6-0d53-b699-869a0588ee39@redhat.com> (raw)
In-Reply-To: <20220911095923.3614387-2-pasha.tatashin@soleen.com>

On 11.09.22 11:59, Pasha Tatashin wrote:
> 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 e2062748791a..665ece0d55d4 100644
> --- a/mm/page_table_check.c
> +++ b/mm/page_table_check.c
> @@ -102,6 +102,8 @@ static void page_table_check_set(struct mm_struct *mm, unsigned long addr,
>   	if (!pfn_valid(pfn))
>   		return;
>   
> +	BUG_ON(is_zero_pfn(pfn) && rw);

We most probably don't want that:

https://lkml.kernel.org/r/20220923113426.52871-2-david@redhat.com

-- 
Thanks,

David / dhildenb



  parent reply	other threads:[~2022-09-26  8:26 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-11  9:59 [PATCH 0/3] page table check default to warn instead of panic Pasha Tatashin
2022-09-11  9:59 ` [PATCH 1/3] mm/page_table_check: Check writable zero page in page table check Pasha Tatashin
2022-09-12 15:58   ` Edgecombe, Rick P
2022-09-26  8:26   ` David Hildenbrand [this message]
2022-09-11  9:59 ` [PATCH 2/3] mm/page_table_check: Do WARN_ON instead of BUG_ON by default Pasha Tatashin
2022-09-11 16:08   ` Matthew Wilcox
2022-09-11 20:42     ` Pasha Tatashin
2022-09-26  8:28     ` David Hildenbrand
2022-09-26  1:16   ` [mm/page_table_check] 6e807506f4: WARNING:at_mm/page_table_check.c:#page_table_check_set kernel test robot
2022-09-11  9:59 ` [PATCH 3/3] doc/vm: add information about page_table_check=panic Pasha Tatashin
2022-09-12 20:23 ` [PATCH 0/3] page table check default to warn instead of panic Andrew Morton
2022-09-20 18:11   ` Pasha Tatashin

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=353188b6-1fa6-0d53-b699-869a0588ee39@redhat.com \
    --to=david@redhat.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=pasha.tatashin@soleen.com \
    --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;
as well as URLs for NNTP newsgroup(s).