summaryrefslogtreecommitdiff
path: root/i386
diff options
context:
space:
mode:
authorFlavio Cruz <flaviocruz@gmail.com>2023-11-30 02:08:01 -0500
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2023-12-03 01:01:41 +0100
commit29d4bcaafc4c2040df27a6247603c68e7757205c (patch)
treee690beca8fd1b0ff00645798dab866df6e77a67c /i386
parent2db6b9b7b23b3bab944665b3b6012d24dd425d97 (diff)
x86_64: Support 8 byte inlined port rights to avoid message resizing.
If a port is inlined in a message, the user has to use mach_port_name_inlined_t to define each port. Out of line memory continues to use mach_port_name_t since that memory has to be copied to the kernel anyway. Both copyinmsg and copyoutmsg can be reduced to nothing (if we ignore USER32) as a follow up but kept this patch simple for ease of review. Message-ID: <ZWg00XzFPqqL1yF-@jupiter.tail36e24.ts.net>
Diffstat (limited to 'i386')
-rw-r--r--i386/i386/copy_user.h12
1 files changed, 5 insertions, 7 deletions
diff --git a/i386/i386/copy_user.h b/i386/i386/copy_user.h
index 5cdbfa80..3d1c7278 100644
--- a/i386/i386/copy_user.h
+++ b/i386/i386/copy_user.h
@@ -87,16 +87,14 @@ static inline int copyout_port(const mach_port_t *kaddr, mach_port_name_t *uaddr
#endif /* __x86_64__ */
}
-// XXX we could add another field to kmsg to store the user-side size, but then we
-// should check if we can obtain it for rpc and notifications originating from
-// the kernel
-#ifndef __x86_64__
+#if defined(__x86_64__) && defined(USER32)
+/* For 32 bit userland, kernel and user land messages are not the same size. */
+size_t msg_usize(const mach_msg_header_t *kmsg);
+#else
static inline size_t msg_usize(const mach_msg_header_t *kmsg)
{
return kmsg->msgh_size;
}
-#else /* __x86_64__ */
-size_t msg_usize(const mach_msg_header_t *kmsg);
-#endif /* __x86_64__ */
+#endif /* __x86_64__ && USER32 */
#endif /* COPY_USER_H */