Usenet comp.os.linux.alpha (1997-2013)
 help / color / mirror / Atom feed
* Re: memory lock problem in Linux
       [not found] ` <61hb1m$see$1@dot.cygnus.com>
@ 1997-10-13  4:00   ` Wolfram Gloger
  0 siblings, 0 replies; only message in thread
From: Wolfram Gloger @ 1997-10-13  4:00 UTC (permalink / raw)



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.



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1997-10-13  4:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <61g5uk$dfu$1@mrnews.mro.dec.com>
     [not found] ` <61hb1m$see$1@dot.cygnus.com>
1997-10-13  4:00   ` memory lock problem in Linux Wolfram Gloger

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