aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlavio Cruz <flaviocruz@gmail.com>2023-01-11 23:22:53 -0500
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2023-01-13 00:57:55 +0100
commit92fad38a043b75ed6b435b3efa574ede91dbe9ee (patch)
treec9d5294f70db01fb06912b7e24ebfca985f528ea
parent963b1794d7117064cee8ab5638b329db51dad854 (diff)
downloadgnumach-92fad38a043b75ed6b435b3efa574ede91dbe9ee.tar.gz
gnumach-92fad38a043b75ed6b435b3efa574ede91dbe9ee.tar.bz2
gnumach-92fad38a043b75ed6b435b3efa574ede91dbe9ee.zip
Use rpc_uintptr_t for protected payloads.
Not only is uintptr_t more accurate for what protected payloads are but we also provide compatibility for 64 + 32 bits. Also the use of natural_t in the RPC definition is wrong since it is always 32 bits. Message-Id: <Y7+LHVbmYxO/cSKs@jupiter.tail36e24.ts.net>
-rw-r--r--i386/include/mach/i386/vm_types.h2
-rw-r--r--include/mach/mach_port.defs2
-rw-r--r--include/mach/mach_types.defs2
-rw-r--r--include/mach/message.h2
-rw-r--r--ipc/ipc_kmsg.c8
-rw-r--r--ipc/ipc_port.c2
-rw-r--r--ipc/ipc_port.h4
-rw-r--r--ipc/mach_msg.c6
-rw-r--r--ipc/mach_port.c2
-rw-r--r--ipc/mach_port.h2
10 files changed, 18 insertions, 14 deletions
diff --git a/i386/include/mach/i386/vm_types.h b/i386/include/mach/i386/vm_types.h
index 4522f48b..663f920a 100644
--- a/i386/include/mach/i386/vm_types.h
+++ b/i386/include/mach/i386/vm_types.h
@@ -110,6 +110,7 @@ typedef vm_size_t * vm_size_array_t;
* functions.
*/
#if defined(MACH_KERNEL) && defined(USER32)
+typedef uint32_t rpc_uintptr_t;
typedef uint32_t rpc_vm_address_t;
typedef uint32_t rpc_vm_offset_t;
typedef uint32_t rpc_vm_size_t;
@@ -139,6 +140,7 @@ static inline int32_t convert_long_integer_to_user(int64_t i)
typedef uint32_t rpc_long_natural_t;
typedef int32_t rpc_long_integer_t;
#else /* MACH_KERNEL */
+typedef uintptr_t rpc_uintptr_t;
typedef vm_offset_t rpc_vm_address_t;
typedef vm_offset_t rpc_vm_offset_t;
typedef vm_size_t rpc_vm_size_t;
diff --git a/include/mach/mach_port.defs b/include/mach/mach_port.defs
index 7cb8a659..3823bb14 100644
--- a/include/mach/mach_port.defs
+++ b/include/mach/mach_port.defs
@@ -348,7 +348,7 @@ skip; /* mach_port_create_act */
routine mach_port_set_protected_payload(
task : ipc_space_t;
name : mach_port_name_t;
- payload : natural_t);
+ payload : rpc_uintptr_t);
/*
* Only valid for receive rights.
diff --git a/include/mach/mach_types.defs b/include/mach/mach_types.defs
index 5e5d0f2f..a98e5c67 100644
--- a/include/mach/mach_types.defs
+++ b/include/mach/mach_types.defs
@@ -121,8 +121,10 @@ type ipc_space_t = mach_port_t
;
#if defined(KERNEL) && defined(USER32)
+type rpc_uintptr_t = uint32_t;
type rpc_vm_size_t = uint32_t;
#else /* KERNEL and USER32 */
+type rpc_uintptr_t = uintptr_t;
type rpc_vm_size_t = uintptr_t;
#endif /* KERNEL_SERVER and USER32 */
diff --git a/include/mach/message.h b/include/mach/message.h
index e6d26f58..798b47b4 100644
--- a/include/mach/message.h
+++ b/include/mach/message.h
@@ -138,7 +138,7 @@ typedef struct mach_msg_header {
mach_port_t msgh_remote_port;
union {
mach_port_t msgh_local_port;
- unsigned long msgh_protected_payload;
+ rpc_uintptr_t msgh_protected_payload;
};
mach_port_seqno_t msgh_seqno;
mach_msg_id_t msgh_id;
diff --git a/ipc/ipc_kmsg.c b/ipc/ipc_kmsg.c
index 73041703..62e138c7 100644
--- a/ipc/ipc_kmsg.c
+++ b/ipc/ipc_kmsg.c
@@ -1727,7 +1727,7 @@ ipc_kmsg_copyout_header(
case MACH_MSGH_BITS(MACH_MSG_TYPE_PORT_SEND, 0): {
mach_port_name_t dest_name;
ipc_port_t nsrequest;
- unsigned long payload;
+ rpc_uintptr_t payload;
/* receiving an asynchronous message */
@@ -1780,7 +1780,7 @@ ipc_kmsg_copyout_header(
ipc_port_t reply = (ipc_port_t) msg->msgh_local_port;
mach_port_name_t dest_name, reply_name;
ipc_port_t nsrequest;
- unsigned long payload;
+ rpc_uintptr_t payload;
/* receiving a request message */
@@ -1882,7 +1882,7 @@ ipc_kmsg_copyout_header(
case MACH_MSGH_BITS(MACH_MSG_TYPE_PORT_SEND_ONCE, 0): {
mach_port_name_t dest_name;
- unsigned long payload;
+ rpc_uintptr_t payload;
/* receiving a reply message */
@@ -1936,7 +1936,7 @@ ipc_kmsg_copyout_header(
mach_msg_type_name_t reply_type = MACH_MSGH_BITS_LOCAL(mbits);
ipc_port_t reply = (ipc_port_t) msg->msgh_local_port;
mach_port_name_t dest_name, reply_name;
- unsigned long payload;
+ rpc_uintptr_t payload;
if (IP_VALID(reply)) {
ipc_port_t notify_port;
diff --git a/ipc/ipc_port.c b/ipc/ipc_port.c
index a0006cf4..c593e8b3 100644
--- a/ipc/ipc_port.c
+++ b/ipc/ipc_port.c
@@ -431,7 +431,7 @@ ipc_port_set_seqno(
*/
void
-ipc_port_set_protected_payload(ipc_port_t port, unsigned long payload)
+ipc_port_set_protected_payload(ipc_port_t port, rpc_uintptr_t payload)
{
ipc_mqueue_t mqueue;
diff --git a/ipc/ipc_port.h b/ipc/ipc_port.h
index b0433876..022921f7 100644
--- a/ipc/ipc_port.h
+++ b/ipc/ipc_port.h
@@ -97,7 +97,7 @@ struct ipc_port {
mach_port_msgcount_t ip_msgcount;
mach_port_msgcount_t ip_qlimit;
struct ipc_thread_queue ip_blocked;
- unsigned long ip_protected_payload;
+ rpc_uintptr_t ip_protected_payload;
};
#define ip_object ip_target.ipt_object
@@ -264,7 +264,7 @@ extern void
ipc_port_set_seqno(ipc_port_t, mach_port_seqno_t);
extern void
-ipc_port_set_protected_payload(ipc_port_t, unsigned long);
+ipc_port_set_protected_payload(ipc_port_t, rpc_uintptr_t);
extern void
ipc_port_clear_protected_payload(ipc_port_t);
diff --git a/ipc/mach_msg.c b/ipc/mach_msg.c
index 420e2a26..f15164a3 100644
--- a/ipc/mach_msg.c
+++ b/ipc/mach_msg.c
@@ -951,7 +951,7 @@ mach_msg_trap(
ipc_port_t reply_port =
(ipc_port_t) kmsg->ikm_header.msgh_local_port;
mach_port_name_t dest_name, reply_name;
- unsigned long payload;
+ rpc_uintptr_t payload;
/* receiving a request message */
@@ -1056,7 +1056,7 @@ mach_msg_trap(
case MACH_MSGH_BITS(MACH_MSG_TYPE_PORT_SEND_ONCE, 0): {
mach_port_name_t dest_name;
- unsigned long payload;
+ rpc_uintptr_t payload;
/* receiving a reply message */
@@ -1101,7 +1101,7 @@ mach_msg_trap(
case MACH_MSGH_BITS_COMPLEX|
MACH_MSGH_BITS(MACH_MSG_TYPE_PORT_SEND_ONCE, 0): {
mach_port_name_t dest_name;
- unsigned long payload;
+ rpc_uintptr_t payload;
/* receiving a complex reply message */
diff --git a/ipc/mach_port.c b/ipc/mach_port.c
index 1c9cdc97..6edf9f88 100644
--- a/ipc/mach_port.c
+++ b/ipc/mach_port.c
@@ -1511,7 +1511,7 @@ kern_return_t
mach_port_set_protected_payload(
ipc_space_t space,
mach_port_name_t name,
- unsigned long payload)
+ rpc_uintptr_t payload)
{
ipc_port_t port;
kern_return_t kr;
diff --git a/ipc/mach_port.h b/ipc/mach_port.h
index c93c48df..ec260b31 100644
--- a/ipc/mach_port.h
+++ b/ipc/mach_port.h
@@ -157,7 +157,7 @@ kern_return_t
mach_port_set_protected_payload(
ipc_space_t space,
mach_port_name_t name,
- unsigned long payload);
+ rpc_uintptr_t payload);
kern_return_t
mach_port_clear_protected_payload(