public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <andrewm@uow.edu.au>
To: Chris Wedgwood <cw@f00f.org>
Cc: Andrea Arcangeli <andrea@suse.de>,
	Linux Kernel Development <linux-kernel@vger.kernel.org>
Subject: Re: msync() bug
Date: Wed, 11 Jul 2001 00:03:11 +1000	[thread overview]
Message-ID: <3B4B0B1F.92EC5C0E@uow.edu.au> (raw)
In-Reply-To: <20010709170835.J1594@athlon.random> <20010711012524.A31799@weta.f00f.org>

Chris Wedgwood wrote:
> 
> (cc' list snipped)
> 
> This stuff is gold.
> 
> Anyone clueful want to comment things so this will end up in the
> documentation when you do a make docbook or something?
> 

One can but try.

Linus included the test for non-null page->mapping
as well.  I wonder why.

Also, the change means that the TLB flush is not performed
for invalid or reserved pages.  Is this correct?  (Why is there
a TLB flush there in the first place?)

There's a flush_tlb_range() down in filemap_sync() as well, so
we appear to end up flushing the affected TLBs twice?


--- linux-2.4.7-pre5/mm/memory.c	Tue Jul 10 22:32:53 2001
+++ linux-akpm/mm/memory.c	Tue Jul 10 23:37:45 2001
@@ -766,6 +766,8 @@ int zeromap_page_range(unsigned long add
  * maps a range of physical memory into the requested pages. the old
  * mappings are removed. any references to nonexistent pages results
  * in null mappings (currently treated as "copy-on-access")
+ * We forbid mapping of valid, unreserved pages because that would
+ * allow corruption of their reference counts via this additional mapping.
  */
 static inline void remap_pte_range(pte_t * pte, unsigned long address, unsigned long size,
 	unsigned long phys_addr, pgprot_t prot)
--- linux-2.4.7-pre5/mm/filemap.c	Tue Jul 10 22:32:53 2001
+++ linux-akpm/mm/filemap.c	Tue Jul 10 23:45:28 2001
@@ -1643,6 +1643,8 @@ page_not_uptodate:
 
 /* Called with mm->page_table_lock held to protect against other
  * threads/the swapper from ripping pte's out from under us.
+ * Mappings from remap_pte_range() can cover invalid or reserved
+ * pages, so we must check for that here.
  */
 static inline int filemap_sync_pte(pte_t * ptep, struct vm_area_struct *vma,
 	unsigned long address, unsigned int flags)

  reply	other threads:[~2001-07-10 14:02 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-09  8:50 msync() bug Abraham vd Merwe
2001-07-09 12:32 ` Andrew Morton
2001-07-09 14:21   ` Andrea Arcangeli
2001-07-09 14:43     ` Andrew Morton
2001-07-09 15:08       ` Andrea Arcangeli
2001-07-09 17:37         ` Hugh Dickins
2001-07-09 17:42           ` Linus Torvalds
2001-07-09 17:58             ` Hugh Dickins
2001-07-09 18:00               ` Linus Torvalds
2001-07-10 13:25         ` Chris Wedgwood
2001-07-10 14:03           ` Andrew Morton [this message]
2001-07-10 14:15             ` Andrea Arcangeli

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=3B4B0B1F.92EC5C0E@uow.edu.au \
    --to=andrewm@uow.edu.au \
    --cc=andrea@suse.de \
    --cc=cw@f00f.org \
    --cc=linux-kernel@vger.kernel.org \
    /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