hurd-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] proxy memory objects


From: Thomas Bushnell, BSG
Subject: Re: [PATCH] proxy memory objects
Date: 11 Dec 2002 21:55:35 -0800
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

Here is where the problem is.  Note that if the user creates a
(secondary) proxy of a (primary) proxy, then the object returned by
memory_object_proxy_lookup into real_memobj will actually be a proxy
itself, and not a real memory object.  Then vm_object_enter will fail.

There are two ways of fixing this.  

One is to have the create_proxy call say "oh, you're creating a
secondary proxy".  Then it would need to make a new proxy on the same
real memory object, and its permissions would be the AND of the ones
provided and the ones in the primary proxy.  
one.  

The other is to have vm_map call memory_object_proxy_lookup over and
over again (in a loop).  It would call it, and check the access
permissions.  And then, if the result was a proxy, loop!

(Incidental question: why does vm_object_enter fail on a proxy?  I
would have expected it to hang when the call to memory_object_init
fails to get a proper response.  That is, it should see that this is
the first time the kernel has noticed this "pager", send
memory_object_init to it, and then do the vm_object_wait call looking
for VM_OBJECT_EVENT_INITIALIZED, which should never happen.)


> Index: vm/vm_user.c
> ===================================================================
> RCS file: /cvsroot/hurd/gnumach/vm/vm_user.c,v
> retrieving revision 1.1.1.1
> diff -u -p -r1.1.1.1 vm_user.c
> --- vm/vm_user.c      25 Feb 1997 21:28:37 -0000      1.1.1.1
> +++ vm/vm_user.c      20 Nov 2002 22:01:14 -0000
> @@ -275,6 +275,12 @@ kern_return_t vm_copy(map, source_addres
>       return KERN_SUCCESS;
>  }
>  
> +
> +/* XXX From memory_object_proxy.c  */
> +kern_return_t
> +memory_object_proxy_lookup (ipc_port_t proxy_object, ipc_port_t *object,
> +                            vm_prot_t *max_protection);
> +
>  /*
>   *   Routine:        vm_map
>   */
> @@ -324,7 +330,22 @@ kern_return_t vm_map(
>               copy = FALSE;
>       } else if ((object = vm_object_enter(memory_object, size, FALSE))
>                       == VM_OBJECT_NULL)
> -             return(KERN_INVALID_ARGUMENT);
> +       {
> +         ipc_port_t real_memobj;
> +         vm_prot_t prot;
> +         result = memory_object_proxy_lookup (memory_object, &real_memobj,
> +                                              &prot);
> +         if (result != KERN_SUCCESS)
> +           return result;
> +
> +         /* Reduce the allowed access to the memory object.  */
> +         max_protection &= prot;
> +         cur_protection &= prot;
> +
> +         if ((object = vm_object_enter(real_memobj, size, FALSE))
> +             == VM_OBJECT_NULL)
> +           return KERN_INVALID_ARGUMENT;
> +       }
>  
>       /*
>        *      Perform the copy if requested





reply via email to

[Prev in Thread] Current Thread [Next in Thread]