Source-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/sys/arch/xen/xen



On Fri, Oct 10, 2008 at 03:25:56PM +0900, YAMAMOTO Takashi wrote:
> hi,
> 
> > Module Name:        src
> > Committed By:       bouyer
> > Date:               Sat Sep 20 20:36:09 UTC 2008
> > 
> > Modified Files:
> >     src/sys/arch/xen/xen: privcmd.c
> > 
> > Log Message:
> > Fix IOCTL_PRIVCMD_MMAPBATCH: don't blindly map requested pages read/write
> > but use the map's protection bits, as the hypervisor may refuse read/write
> > mappings for some entries. Now suspend/resume of domUs should work
> > from a NetBSD dom0, provided that the domU's kernel supports it.
> > 
> > From Jean-Yves Migeon.
> > 
> > 
> > To generate a diff of this commit:
> > cvs rdiff -r1.29 -r1.30 src/sys/arch/xen/xen/privcmd.c
> > 
> > Please note that diffs are not public domain; they are subject to the
> > copyright notices on the relevant files.
> 
> what prevents the 'entry' pointer from getting invalid
> while you release the vm_map lock?

Ha yes, entry is a pointer and not a vm_map_entry. I guess the attached patch
would fix it ?

-- 
Manuel Bouyer <bouyer%antioche.eu.org@localhost>
     NetBSD: 26 ans d'experience feront toujours la difference
--
Index: privcmd.c
===================================================================
RCS file: /cvsroot/src/sys/arch/xen/xen/privcmd.c,v
retrieving revision 1.30
diff -u -p -u -r1.30 privcmd.c
--- privcmd.c   20 Sep 2008 20:36:09 -0000      1.30
+++ privcmd.c   10 Oct 2008 20:28:49 -0000
@@ -401,6 +401,7 @@ privcmd_ioctl(void *v)
                u_long mfn, ma;
                struct vm_map *vmm;
                struct vm_map_entry *entry;
+               vm_prot_t prot;
                pmap_t pmap;
                vaddr_t trymap;
 
@@ -418,6 +419,7 @@ privcmd_ioctl(void *v)
                        vm_map_unlock_read(vmm);
                        return EINVAL;
                }
+               prot = entry->protection;
                vm_map_unlock_read(vmm);
                
                maddr = kmem_alloc(sizeof(paddr_t) * pmb->num, KM_SLEEP);
@@ -442,8 +444,7 @@ privcmd_ioctl(void *v)
                        }
                        ma = mfn << PGSHIFT;
                        if (pmap_enter_ma(pmap_kernel(), trymap, ma, 0,
-                           entry->protection, PMAP_CANFAIL,
-                           pmb->dom)) {
+                           prot, PMAP_CANFAIL, pmb->dom)) {
                                mfn |= 0xF0000000;
                                copyout(&mfn, &pmb->arr[i], sizeof(mfn));
                                maddr[i] = INVALID_PAGE;


Home | Main Index | Thread Index | Old Index