[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 09/17] Move copy{in,out}msg declarations to copy_user.h
From: |
Samuel Thibault |
Subject: |
Re: [PATCH 09/17] Move copy{in,out}msg declarations to copy_user.h |
Date: |
Wed, 27 Mar 2024 19:49:40 +0100 |
User-agent: |
NeoMutt/20170609 (1.8.3) |
Sergey Bugaev, le mer. 27 mars 2024 19:18:33 +0300, a ecrit:
> Since they are implemented in copy_user.c
> ---
> i386/i386/locore.h | 4 ----
> ipc/copy_user.h | 15 +++++++++++++++
> kern/exception.c | 1 +
> 3 files changed, 16 insertions(+), 4 deletions(-)
>
> diff --git a/i386/i386/locore.h b/i386/i386/locore.h
> index 217e6dec..8ff587ed 100644
> --- a/i386/i386/locore.h
> +++ b/i386/i386/locore.h
> @@ -52,10 +52,6 @@ extern int copyinmsg (const void *userbuf, void
> *kernelbuf, size_t cn, size_t kn
> extern int copyout (const void *kernelbuf, void *userbuf, size_t cn);
> #ifdef USER32
> extern int copyoutmsg (const void *kernelbuf, void *userbuf, size_t cn);
Didn't you also want to move this one?
> -#else
> -static inline int copyoutmsg (const void *kernelbuf, void *userbuf, size_t
> cn) {
> - return copyout (kernelbuf, userbuf, cn);
> -}
> #endif
>
> extern int inst_fetch (int eip, int cs);
> diff --git a/ipc/copy_user.h b/ipc/copy_user.h
> index a57b3ee5..33beacd0 100644
> --- a/ipc/copy_user.h
> +++ b/ipc/copy_user.h
> @@ -25,6 +25,21 @@
> #include <machine/locore.h>
> #include <mach/message.h>
>
> +int copyinmsg(
> + const void *userbuf,
> + void *kernelbuf,
> + size_t usize,
> + size_t ksize);
> +
> +#ifdef USER32
> +int copyoutmsg(
> + const void *kernelbuf,
> + void *userbuf,
> + size_t ksize);
> +#else
> +#define copyoutmsg copyout
Better define with parameters, so that it doesn't catch e.g. variables
called copyoutmsg.
> +#endif
> +
> /*
> * The copyin_32to64() and copyout_64to32() routines are meant for data types
> * that have different size in kernel and user space. They should be
> independent
> diff --git a/kern/exception.c b/kern/exception.c
> index 7139b466..cc023d45 100644
> --- a/kern/exception.c
> +++ b/kern/exception.c
> @@ -30,6 +30,7 @@
> #include <mach/port.h>
> #include <mach/mig_errors.h>
> #include <machine/locore.h>
> +#include <ipc/copy_user.h>
> #include <ipc/port.h>
> #include <ipc/ipc_entry.h>
> #include <ipc/ipc_notify.h>
> --
> 2.44.0
>
>
--
Samuel
---
Pour une évaluation indépendante, transparente et rigoureuse !
Je soutiens la Commission d'Évaluation de l'Inria.
- Re: [PATCH 06/17] kern/syscall_subr.c: Use copyin()/copyout() to access user memory, (continued)
- [PATCH 03/17] Use the x86_64 message ABI on all 64-bit ports, Sergey Bugaev, 2024/03/27
- [PATCH 02/17] Disable host_kernel_version() everywhere but on i386, Sergey Bugaev, 2024/03/27
- [PATCH 08/17] ipc: Turn ipc_entry_lookup_failed() into a macro, Sergey Bugaev, 2024/03/27
- [PATCH 11/17] tests: Fix halt(), Sergey Bugaev, 2024/03/27
- [PATCH 09/17] Move copy{in,out}msg declarations to copy_user.h, Sergey Bugaev, 2024/03/27
- Re: [PATCH 09/17] Move copy{in,out}msg declarations to copy_user.h,
Samuel Thibault <=
- [PATCH 15/17] tests: Make exception subcode a long, Sergey Bugaev, 2024/03/27
- [PATCH 12/17] tests: Add a more serious mach_msg_server() routine, Sergey Bugaev, 2024/03/27
- [PATCH 07/17] kern/rdxtree: Fix undefined behavior, Sergey Bugaev, 2024/03/27
- [PATCH 17/17] tests: Create tests/ in the build tree before trying to use it, Sergey Bugaev, 2024/03/27
- [PATCH 16/17] tests: Don't ask for executable stack, Sergey Bugaev, 2024/03/27