linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: William Lee Irwin III <wli@holomorphy.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: Linus Torvalds <torvalds@transmeta.com>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [patch, feature] nonlinear mappings, prefaulting support, 2.5.42-F8
Date: Mon, 14 Oct 2002 14:20:45 -0700	[thread overview]
Message-ID: <20021014212045.GF27878@holomorphy.com> (raw)
In-Reply-To: <Pine.LNX.4.44.0210141800160.9302-100000@localhost.localdomain>

On Mon, Oct 14, 2002 at 06:02:30PM +0200, Ingo Molnar wrote:
>> if this is really an issue then we could force vma->vm_page_prot to
>> PROT_NONE within remap_file_pages(), so at least all subsequent faults
>> will be PROT_NONE and the user would have to explicitly re-mprotect()
>> the vma again to change this.
> i've added this to the -G1 patch at:
>         http://redhat.com/~mingo/remap-file-pages-patches/
>     Ingo

Also, this may be relaxed when the file offsets match.
Against unpatched -G1:


Bill


--- mpop-2.5.42/mm/fremap.c	2002-10-14 11:43:03.000000000 -0700
+++ wlipop-2.5.42/mm/fremap.c	2002-10-14 14:17:11.000000000 -0700
@@ -129,10 +129,16 @@
 			end > start && start >= vma->vm_start &&
 				end <= vma->vm_end) {
 		/*
-		 * Change the default protection to PROT_NONE:
+		 * Change the default protection to PROT_NONE if
+		 * the file offset doesn't coincide with the vma's:
 		 */
-		if (pgprot_val(vma->vm_page_prot) != pgprot_val(__S000))
-			vma->vm_page_prot = __S000;
+		if (pgprot_val(vma->vm_page_prot) != pgprot_val(__S000)) {
+			unsigned long offset;
+			offset = (start - vma->vm_start) >> PAGE_CACHE_SHIFT
+					+ vma->vm_pgoff;
+			if (offset != pgoff)
+				vma->vm_page_prot = __S000;
+		}
 		err = vma->vm_ops->populate(vma, start, size, prot,
 						pgoff, flags & MAP_NONBLOCK);
 	}

  parent reply	other threads:[~2002-10-14 21:18 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-14 12:38 [patch, feature] nonlinear mappings, prefaulting support, 2.5.42-F8 Ingo Molnar
2002-10-14 12:45 ` David S. Miller
2002-10-14 13:30   ` Ingo Molnar
2002-10-14 13:18     ` David S. Miller
2002-10-14 13:52 ` William Lee Irwin III
2002-10-14 15:02   ` Ingo Molnar
2002-10-14 15:15     ` Ingo Molnar
2002-10-14 15:20     ` William Lee Irwin III
2002-10-14 15:52       ` Ingo Molnar
2002-10-14 16:02         ` Ingo Molnar
2002-10-14 21:02           ` William Lee Irwin III
2002-10-14 21:20           ` William Lee Irwin III [this message]
2002-10-14 21:25             ` William Lee Irwin III
2002-10-14 20:27 ` Andrew Morton
2002-10-15  1:18 ` Jamie Lokier
2002-10-15  6:48   ` Linus Torvalds

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=20021014212045.GF27878@holomorphy.com \
    --to=wli@holomorphy.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mingo@elte.hu \
    --cc=torvalds@transmeta.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).