bug-hurd
[Top][All Lists]
Advanced

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

Re: [PATCH gnumach] Implement mig_deallocate to free memory when kernel


From: Samuel Thibault
Subject: Re: [PATCH gnumach] Implement mig_deallocate to free memory when kernel server RPC succeeds
Date: Tue, 2 May 2023 07:54:37 +0200
User-agent: NeoMutt/20170609 (1.8.3)

Applied, thanks!

Flavio Cruz, le lun. 01 mai 2023 22:52:19 -0400, a ecrit:
> In case the kernel interfaces use dynamically sized strings, we will
> end up calling mig_deallocate to free the out of line string that was copied
> into the kernel. As a matter of contract such type of data is freed
> automatically either in kernel code when the RPC fails or in the MiG
> stub if it succeeds.
> 
> This was tested by changing task_set_name to use dynamic strings and making
> sure out of line data is passed when strlen(name) > 4.
> ---
>  kern/ipc_mig.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/kern/ipc_mig.c b/kern/ipc_mig.c
> index cb0b2c83..a145f8c5 100644
> --- a/kern/ipc_mig.c
> +++ b/kern/ipc_mig.c
> @@ -303,6 +303,16 @@ mig_strncpy(char *dest, const char *src, int len)
>       return dest - dest_;
>  }
>  
> +/* Called by MiG to deallocate memory, which in this case happens
> + * to be kernel memory. */
> +void
> +mig_deallocate(vm_address_t addr, vm_size_t size)
> +{
> +     (void) size;
> +     /* We do the same thing as in ipc_kmsg_clean_body. */
> +     vm_map_copy_discard((vm_map_copy_t) addr);
> +}
> +
>  #define      fast_send_right_lookup(name, port, abort)                       
> \
>  MACRO_BEGIN                                                          \
>       ipc_space_t space = current_space();                            \
> -- 
> 2.39.2
> 
> 

-- 
Samuel
---
Pour une évaluation indépendante, transparente et rigoureuse !
Je soutiens la Commission d'Évaluation de l'Inria.



reply via email to

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