diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2023-10-01 03:19:17 +0200 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2023-10-01 04:27:00 +0200 |
commit | 2a92200459c3293e42de91d59a398177a72777e3 (patch) | |
tree | b92c8a5958e190b8edbe53ba64c0839b889bbc51 /x86_64 | |
parent | 42bdb9e4fea494b85b394dd99d1686e812eb8a28 (diff) | |
download | gnumach-2a92200459c3293e42de91d59a398177a72777e3.tar.gz gnumach-2a92200459c3293e42de91d59a398177a72777e3.tar.bz2 gnumach-2a92200459c3293e42de91d59a398177a72777e3.zip |
copyout_unpack_msg_type: Avoid changing the kernel header
Diffstat (limited to 'x86_64')
-rw-r--r-- | x86_64/copy_user.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/x86_64/copy_user.c b/x86_64/copy_user.c index 548d9d7d..178a7545 100644 --- a/x86_64/copy_user.c +++ b/x86_64/copy_user.c @@ -262,10 +262,16 @@ static inline int copyout_unpack_msg_type(vm_offset_t kaddr, if (kmt->msgt_longform) { mach_msg_type_long_t* kmtl = (mach_msg_type_long_t*)kaddr; + mach_msg_type_size_t orig_size = kmtl->msgtl_size; + int ret; + if (MACH_MSG_TYPE_PORT_ANY(kmtl->msgtl_name)) kmtl->msgtl_size = bytes_to_descsize(sizeof(mach_port_name_t)); - if (copyout_mach_msg_type_long(kmtl, (void*)uaddr)) + ret = copyout_mach_msg_type_long(kmtl, (void*)uaddr); + kmtl->msgtl_size = orig_size; + if (ret) return 1; + *name = kmtl->msgtl_name; *size = kmtl->msgtl_size; *number = kmtl->msgtl_number; @@ -274,10 +280,16 @@ static inline int copyout_unpack_msg_type(vm_offset_t kaddr, } else { + mach_msg_type_size_t orig_size = kmt->msgt_size; + int ret; + if (MACH_MSG_TYPE_PORT_ANY(kmt->msgt_name)) kmt->msgt_size = bytes_to_descsize(sizeof(mach_port_name_t)); - if (copyout_mach_msg_type(kmt, (void *)uaddr)) + ret = copyout_mach_msg_type(kmt, (void *)uaddr); + kmt->msgt_size = orig_size; + if (ret) return 1; + *name = kmt->msgt_name; *size = kmt->msgt_size; *number = kmt->msgt_number; |