aboutsummaryrefslogtreecommitdiff
path: root/include/mach
diff options
context:
space:
mode:
authorFlavio Cruz <flaviocruz@gmail.com>2023-02-12 13:11:13 -0500
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2023-02-12 19:43:00 +0100
commite09f2d9584375a0d9e06bbcadec1910b042df620 (patch)
treed777fb64dcaac3893bced15ccfa5d946984a58bb /include/mach
parent6a46db9fe035c26ab549bc0b681469fc650141d6 (diff)
downloadgnumach-e09f2d9584375a0d9e06bbcadec1910b042df620.tar.gz
gnumach-e09f2d9584375a0d9e06bbcadec1910b042df620.tar.bz2
gnumach-e09f2d9584375a0d9e06bbcadec1910b042df620.zip
Consider protected payloads in mach_msg_header_t when resizing messages.
Protected payloads will be 8-byte longs which are the same size as kernel ports. Also aligned all the structures to be 4-byte aligned since it makes it easier to parse them as padding won't be added to mach_msg_user_header_t before the protected payload. Message-Id: <Y+krwRFIUeyRszl9@jupiter.tail36e24.ts.net>
Diffstat (limited to 'include/mach')
-rw-r--r--include/mach/message.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/include/mach/message.h b/include/mach/message.h
index 21c551c2..63341e6f 100644
--- a/include/mach/message.h
+++ b/include/mach/message.h
@@ -132,6 +132,9 @@ typedef unsigned int mach_msg_size_t;
typedef natural_t mach_msg_seqno_t;
typedef integer_t mach_msg_id_t;
+/* Force 4-byte alignment to simplify how the kernel parses the messages */
+#pragma pack(push, 4)
+
/* full header structure, may have different size in user/kernel spaces */
typedef struct mach_msg_header {
mach_msg_bits_t msgh_bits;
@@ -151,7 +154,10 @@ typedef struct {
mach_msg_bits_t msgh_bits;
mach_msg_size_t msgh_size;
mach_port_name_t msgh_remote_port;
- mach_port_name_t msgh_local_port;
+ union {
+ mach_port_name_t msgh_local_port;
+ rpc_uintptr_t msgh_protected_payload;
+ };
mach_port_seqno_t msgh_seqno;
mach_msg_id_t msgh_id;
} mach_msg_user_header_t;
@@ -224,6 +230,7 @@ typedef struct {
natural_t msgtl_number;
} mach_msg_type_long_t;
+#pragma pack(pop)
/*
* Known values for the msgt_name field.