From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f5392,a725b7b51c2e4080,start X-Google-Attributes: gidf5392,public X-Google-Thread: 111c93,a725b7b51c2e4080,start X-Google-Attributes: gid111c93,public From: Wolfram Gloger Subject: Re: memory lock problem in Linux Date: 1997/10/13 Message-ID: #1/1 X-Deja-AN: 280107505 Distribution: world Sender: wmglo@md.dent.med.uni-muenchen.de References: <61g5uk$dfu$1@mrnews.mro.dec.com> <61hb1m$see$1@dot.cygnus.com> Organization: [posted via] Leibniz-Rechenzentrum, Muenchen (Germany) Newsgroups: comp.os.linux.alpha,comp.os.linux.development.system 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.