Usenet comp.os.linux.alpha (1997-2013)
 help / color / mirror / Atom feed
From: Wolfram Gloger <wmglo@dent.med.uni-muenchen.de>
Subject: Re: memory lock problem in Linux
Date: 1997/10/13	[thread overview]
Message-ID: <u4afgdai56.fsf@md.dent.med.uni-muenchen.de> (raw)
In-Reply-To: 61hb1m$see$1@dot.cygnus.com


rth@dot.cygnus.com (Richard Henderson) writes:

> The fix is, in linux/mm/mlock.c, mlock_fixup(), to ignore VMA's that
> are PROT_NONE.

OK, while we're fixing this, shouldn't we also account for the mlock()
case where _writeable_ VMA's have been mapped as copies of the zero
page, but haven't yet been written to and hence not been physically
allocated?  I would therefore suggest the following patch:

--- mm/mlock.c.orig	Wed Aug 13 11:32:30 1997
+++ mm/mlock.c	Mon Oct 13 15:24:10 1997
@@ -124,10 +124,12 @@
 			pages = -pages;
 		vma->vm_mm->locked_vm += pages;
 
-		if (newflags & VM_LOCKED)
+		if ((newflags & VM_LOCKED) && (newflags & VM_READ))
 			while (start < end) {
-				char c = get_user((char *) start);
+				int c = get_user((int *) start);
 				__asm__ __volatile__("": :"r" (c));
+				if (newflags & VM_WRITE)
+					put_user(c, (int *) start);
 				start += PAGE_SIZE;
 			}
 	}

If I don't hear about objections, I'll submit this to Linus for
2.0.31.

Regards,
Wolfram.



           reply	other threads:[~1997-10-13  4:00 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <61hb1m$see$1@dot.cygnus.com>]
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox