bug-hurd
[Top][All Lists]
Advanced

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

Re: [PATCH 3/7] update syscall signature with rpc_vm_* and mach_port_nam


From: Samuel Thibault
Subject: Re: [PATCH 3/7] update syscall signature with rpc_vm_* and mach_port_name_t
Date: Wed, 18 Jan 2023 02:24:23 +0100
User-agent: NeoMutt/20170609 (1.8.3)

Applied, thanks!

Luca Dariz, le lun. 16 janv. 2023 11:58:53 +0100, a ecrit:
> * include/mach/mach_types.h: use mach port names
> * kern/ipc_mig.c:  update vm types and use copyin/copyout helpers
> * kern/ipc_mig.h: Likewise
> 
> Signed-off-by: Luca Dariz <luca@orpolo.org>
> ---
>  include/mach/mach_traps.h | 18 ++++-------------
>  kern/ipc_mig.c            | 41 +++++++++++++++++++++------------------
>  kern/ipc_mig.h            | 30 ++++++++++++++--------------
>  3 files changed, 41 insertions(+), 48 deletions(-)
> 
> diff --git a/include/mach/mach_traps.h b/include/mach/mach_traps.h
> index 0433707a..2a87f62a 100644
> --- a/include/mach/mach_traps.h
> +++ b/include/mach/mach_traps.h
> @@ -35,19 +35,9 @@
>  
>  #include <mach/port.h>
>  
> -mach_port_t  mach_reply_port
> -                     (void);
> -
> -mach_port_t  mach_thread_self
> -                     (void);
> -
> -#ifdef       __386BSD__
> -#undef mach_task_self
> -#endif
> -mach_port_t  mach_task_self
> -                     (void);
> -
> -mach_port_t  mach_host_self
> -                     (void);
> +mach_port_name_t mach_reply_port (void);
> +mach_port_name_t mach_thread_self (void);
> +mach_port_name_t mach_task_self (void);
> +mach_port_name_t mach_host_self (void);
>  
>  #endif       /* _MACH_MACH_TRAPS_H_ */
> diff --git a/kern/ipc_mig.c b/kern/ipc_mig.c
> index a9e3f53b..afda1016 100644
> --- a/kern/ipc_mig.c
> +++ b/kern/ipc_mig.c
> @@ -29,6 +29,7 @@
>  #include <mach/message.h>
>  #include <mach/thread_status.h>
>  #include <machine/locore.h>
> +#include <machine/copy_user.h>
>  #include <kern/ast.h>
>  #include <kern/debug.h>
>  #include <kern/ipc_tt.h>
> @@ -576,12 +577,12 @@ port_name_to_space(mach_port_name_t name)
>  kern_return_t
>  syscall_vm_map(
>       mach_port_name_t        target_map,
> -     vm_offset_t     *address,
> -     vm_size_t       size,
> -     vm_offset_t     mask,
> +     rpc_vm_offset_t *address,
> +     rpc_vm_size_t   size,
> +     rpc_vm_offset_t mask,
>       boolean_t       anywhere,
>       mach_port_name_t        memory_object,
> -     vm_offset_t     offset,
> +     rpc_vm_offset_t offset,
>       boolean_t       copy,
>       vm_prot_t       cur_protection,
>       vm_prot_t       max_protection,
> @@ -607,12 +608,12 @@ syscall_vm_map(
>       } else
>               port = (ipc_port_t) memory_object;
>  
> -     copyin(address, &addr, sizeof(vm_offset_t));
> +     copyin_address(address, &addr);
>       result = vm_map(map, &addr, size, mask, anywhere,
>                       port, offset, copy,
>                       cur_protection, max_protection, inheritance);
>       if (result == KERN_SUCCESS)
> -             copyout(&addr, address, sizeof(vm_offset_t));
> +             copyout_address(&addr, address);
>       if (IP_VALID(port))
>               ipc_port_release_send(port);
>       vm_map_deallocate(map);
> @@ -621,9 +622,9 @@ syscall_vm_map(
>  }
>  
>  kern_return_t syscall_vm_allocate(
> -     mach_port_name_t                target_map,
> -     vm_offset_t             *address,
> -     vm_size_t               size,
> +     mach_port_name_t        target_map,
> +     rpc_vm_offset_t         *address,
> +     rpc_vm_size_t           size,
>       boolean_t               anywhere)
>  {
>       vm_map_t                map;
> @@ -634,19 +635,19 @@ kern_return_t syscall_vm_allocate(
>       if (map == VM_MAP_NULL)
>               return MACH_SEND_INTERRUPTED;
>  
> -     copyin(address, &addr, sizeof(vm_offset_t));
> +     copyin_address(address, &addr);
>       result = vm_allocate(map, &addr, size, anywhere);
>       if (result == KERN_SUCCESS)
> -             copyout(&addr, address, sizeof(vm_offset_t));
> +             copyout_address(&addr, address);
>       vm_map_deallocate(map);
>  
>       return result;
>  }
>  
>  kern_return_t syscall_vm_deallocate(
> -     mach_port_name_t                target_map,
> -     vm_offset_t             start,
> -     vm_size_t               size)
> +     mach_port_name_t        target_map,
> +     rpc_vm_offset_t         start,
> +     rpc_vm_size_t           size)
>  {
>       vm_map_t                map;
>       kern_return_t           result;
> @@ -682,7 +683,7 @@ kern_return_t syscall_task_create(
>               (void) ipc_kmsg_copyout_object(current_space(),
>                                              (ipc_object_t) port,
>                                              MACH_MSG_TYPE_PORT_SEND, &name);
> -             copyout(&name, child_task, sizeof(mach_port_name_t));
> +             copyout_port(&name, child_task);
>       }
>       task_deallocate(t);
>  
> @@ -767,7 +768,9 @@ syscall_mach_port_allocate(
>  
>       kr = mach_port_allocate(space, right, &name);
>       if (kr == KERN_SUCCESS)
> -             copyout(&name, namep, sizeof(mach_port_name_t));
> +     {
> +             copyout_port(&name, namep);
> +     }
>       is_release(space);
>  
>       return kr;
> @@ -873,8 +876,8 @@ syscall_device_write_request(mach_port_name_t     
> device_name,
>                            mach_port_name_t   reply_name,
>                            dev_mode_t         mode,
>                            recnum_t           recnum,
> -                          vm_offset_t        data,
> -                          vm_size_t          data_count)
> +                          rpc_vm_offset_t    data,
> +                          rpc_vm_size_t      data_count)
>  {
>       device_t        dev;
>       /*ipc_port_t    reply_port;*/
> @@ -925,7 +928,7 @@ syscall_device_writev_request(mach_port_name_t    
> device_name,
>                             dev_mode_t        mode,
>                             recnum_t          recnum,
>                             io_buf_vec_t      *iovec,
> -                           vm_size_t         iocount)
> +                           rpc_vm_size_t     iocount)
>  {
>       device_t        dev;
>       /*ipc_port_t    reply_port;*/
> diff --git a/kern/ipc_mig.h b/kern/ipc_mig.h
> index e3ad6deb..c96a00da 100644
> --- a/kern/ipc_mig.h
> +++ b/kern/ipc_mig.h
> @@ -65,12 +65,12 @@ extern mach_msg_return_t mach_msg_rpc_from_kernel(
>  
>  extern kern_return_t syscall_vm_map(
>       mach_port_name_t        target_map,
> -     vm_offset_t     *address,
> -     vm_size_t       size,
> -     vm_offset_t     mask,
> +     rpc_vm_offset_t *address,
> +     rpc_vm_size_t   size,
> +     rpc_vm_offset_t mask,
>       boolean_t       anywhere,
>       mach_port_name_t        memory_object,
> -     vm_offset_t     offset,
> +     rpc_vm_offset_t offset,
>       boolean_t       copy,
>       vm_prot_t       cur_protection,
>       vm_prot_t       max_protection,
> @@ -78,19 +78,19 @@ extern kern_return_t syscall_vm_map(
>  
>  extern kern_return_t syscall_vm_allocate(
>       mach_port_name_t        target_map,
> -     vm_offset_t             *address,
> -     vm_size_t               size,
> +     rpc_vm_offset_t         *address,
> +     rpc_vm_size_t           size,
>       boolean_t               anywhere);
>  
>  extern kern_return_t syscall_vm_deallocate(
>       mach_port_name_t        target_map,
> -     vm_offset_t             start,
> -     vm_size_t               size);
> +     rpc_vm_offset_t         start,
> +     rpc_vm_size_t           size);
>  
>  extern kern_return_t syscall_task_create(
>       mach_port_name_t        parent_task,
> -     boolean_t               inherit_memory,
> -     mach_port_name_t        *child_task);
> +     boolean_t               inherit_memory,
> +        mach_port_name_t     *child_task);
>  
>  extern kern_return_t syscall_task_terminate(mach_port_name_t task);
>  
> @@ -126,10 +126,10 @@ extern kern_return_t 
> syscall_thread_depress_abort(mach_port_name_t thread);
>  extern io_return_t syscall_device_write_request(
>                       mach_port_name_t        device_name,
>                       mach_port_name_t        reply_name,
> -                     dev_mode_t              mode,
> -                     recnum_t                recnum,
> -                     vm_offset_t             data,
> -                     vm_size_t               data_count);
> +                     dev_mode_t      mode,
> +                     recnum_t        recnum,
> +                     rpc_vm_offset_t data,
> +                     rpc_vm_size_t   data_count);
>  
>  io_return_t syscall_device_writev_request(
>                       mach_port_name_t        device_name,
> @@ -137,7 +137,7 @@ io_return_t syscall_device_writev_request(
>                       dev_mode_t      mode,
>                       recnum_t        recnum,
>                       io_buf_vec_t    *iovec,
> -                     vm_size_t       iocount);
> +                     rpc_vm_size_t   iocount);
>  
>  mach_port_name_t mig_get_reply_port(void);
>  
> -- 
> 2.30.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]