aboutsummaryrefslogtreecommitdiff
path: root/hurd
diff options
context:
space:
mode:
authorFlavio Cruz <flaviocruz@gmail.com>2023-12-14 01:02:28 -0500
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2023-12-17 23:48:37 +0100
commitad26c25137086b6e001ce1a7f82b4656724200da (patch)
tree8704cd695817f20c6419d1d629487f1178634176 /hurd
parent0b850186fd3177311f10dcb938b668cc750fa3be (diff)
downloadglibc-ad26c25137086b6e001ce1a7f82b4656724200da.zip
glibc-ad26c25137086b6e001ce1a7f82b4656724200da.tar.gz
glibc-ad26c25137086b6e001ce1a7f82b4656724200da.tar.bz2
Update code to handle the new ABI for sending inlined port rights.
For i686, this change is no op but for x86_64 it forces all inlined port rights to be 8 bytes long.
Diffstat (limited to 'hurd')
-rw-r--r--hurd/intr-msg.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/hurd/intr-msg.c b/hurd/intr-msg.c
index 24184f8..9912f4f 100644
--- a/hurd/intr-msg.c
+++ b/hurd/intr-msg.c
@@ -199,6 +199,28 @@ _hurd_intr_rpc_mach_msg (mach_msg_header_t *msg,
__vm_deallocate (__mach_task_self (), (vm_address_t) data, length);
}
+ inline void clean_inlined_ports (mach_port_name_inlined_t *ports)
+ {
+ mach_msg_type_number_t i;
+ switch (name)
+ {
+ case MACH_MSG_TYPE_MOVE_SEND:
+ for (i = 0; i < number; i++)
+ __mach_port_deallocate (__mach_task_self (), ports[i].name);
+ if (ty->msgtl_header.msgt_longform)
+ ty->msgtl_name = MACH_MSG_TYPE_COPY_SEND;
+ else
+ ty->msgtl_header.msgt_name = MACH_MSG_TYPE_COPY_SEND;
+ break;
+ case MACH_MSG_TYPE_COPY_SEND:
+ case MACH_MSG_TYPE_MOVE_RECEIVE:
+ break;
+ default:
+ if (MACH_MSG_TYPE_PORT_ANY (name))
+ assert (! "unexpected port type in interruptible RPC");
+ }
+ }
+
char *data;
if (ty->msgtl_header.msgt_longform)
{
@@ -215,11 +237,11 @@ _hurd_intr_rpc_mach_msg (mach_msg_header_t *msg,
data = (char *) ty + sizeof (mach_msg_type_t);
}
+ /* Calculate length of data in bytes. */
const vm_size_t length = ((number * size) + 7) >> 3;
if (ty->msgtl_header.msgt_inline)
{
- /* Calculate length of data in bytes. */
- clean_ports_and_memory (data, length, 0);
+ clean_inlined_ports ((mach_port_name_inlined_t *) data);
/* Move to the next argument. */
ty = (void *) PTR_ALIGN_UP (data + length, __alignof__ (uintptr_t));
}