Date: Sat, 12 Apr 2008 14:56:50 -0700 (PDT) From: Matthew Dillon <dillon@apollo.backplane.com> To: Jonathan Chen <jon@freebsd.org> Cc: hackers@freebsd.org Subject: Re: mlock & COW Message-ID: <200804122156.m3CLuot5065753@apollo.backplane.com> References: <20080309212441.GA56523@porthos.spock.org>
next in thread | previous in thread | raw e-mail | index | archive | help
I've looked at it some more and it looks like it would be a real mess to do it in the protection code. I think it may be best to fix it in the fault code. That is, to explicitly allow a user-wired page to be write-faulted. The primary protection check that is causing the segv is in vm_map_lookup() line 3161 and line 3297 (FreeBSD current). Commenting those out will allow the COW on the user-wired page: if ((entry->eflags & MAP_ENTRY_USER_WIRED) && (entry->eflags & MAP_ENTRY_COW) && (fault_type & VM_PROT_WRITE) && (fault_typea & VM_PROT_OVERRIDE_WRITE) == 0) { RETURN(KERN_PROTECTION_FAILURE); } BUT! This is going to cause a panic later on. There is one big gotcha and that is the COW fault will cause the VM system to lose track of the wiring of (I think) either the original page or the COW'd page, and you will get a panic when it tries to unwire it later on. I will mess with it a bit in DragonFly to see if there's a simple solution. -Matt
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200804122156.m3CLuot5065753>