[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 7/8] ipc: clear the payload when moving a receive port
From: |
Justus Winter |
Subject: |
[PATCH 7/8] ipc: clear the payload when moving a receive port |
Date: |
Fri, 29 Nov 2013 01:00:39 +0100 |
Clear the protected payload when a receive port is moved from one ipc
space to another. This is done to retain the old behavior of
mach_msg, so that a port name is sent in the msgh_local_port field.
If the new owner of that receive right wishes to use the protected
payload mechanism, it has to be explicitly set with
mach_port_set_protected_payload.
* ipc/ipc_right.c (ipc_right_copyin): Clear the payload when moving a
receive port.
(ipc_right_copyout): Likewise.
* ipc/ipc_port.c (ipc_port_destroy): Likewise.
* ipc/ipc_object.c (ipc_object_copyin_from_kernel): Likewise.
---
ipc/ipc_object.c | 1 +
ipc/ipc_port.c | 1 +
ipc/ipc_right.c | 12 ++++++++++++
3 files changed, 14 insertions(+)
diff --git a/ipc/ipc_object.c b/ipc/ipc_object.c
index b8cae8f..34a3887 100644
--- a/ipc/ipc_object.c
+++ b/ipc/ipc_object.c
@@ -481,6 +481,7 @@ ipc_object_copyin_from_kernel(
port->ip_receiver_name = MACH_PORT_NULL;
port->ip_destination = IP_NULL;
+ port->ip_protected_payload = 0;
ip_unlock(port);
break;
}
diff --git a/ipc/ipc_port.c b/ipc/ipc_port.c
index e2ff38d..b5367c9 100644
--- a/ipc/ipc_port.c
+++ b/ipc/ipc_port.c
@@ -635,6 +635,7 @@ ipc_port_destroy(
/* make port be in limbo */
port->ip_receiver_name = MACH_PORT_NULL;
port->ip_destination = IP_NULL;
+ port->ip_protected_payload = 0;
ip_unlock(port);
if (!ipc_port_check_circularity(port, pdrequest)) {
diff --git a/ipc/ipc_right.c b/ipc/ipc_right.c
index 41fe3de..1edbb47 100644
--- a/ipc/ipc_right.c
+++ b/ipc/ipc_right.c
@@ -1432,6 +1432,12 @@ ipc_right_copyin(
port->ip_receiver_name = MACH_PORT_NULL;
port->ip_destination = IP_NULL;
+
+ /*
+ * Clear the protected payload field to retain
+ * the behavior of mach_msg.
+ */
+ port->ip_protected_payload = 0;
ip_unlock(port);
*objectp = (ipc_object_t) port;
@@ -1932,6 +1938,12 @@ ipc_right_copyout(
port->ip_receiver_name = name;
port->ip_receiver = space;
+ /*
+ * Clear the protected payload field to retain
+ * the behavior of mach_msg.
+ */
+ port->ip_protected_payload = 0;
+
assert((bits & MACH_PORT_TYPE_RECEIVE) == 0);
if (bits & MACH_PORT_TYPE_SEND) {
--
1.7.10.4
- Implementing protected payloads in GNU Mach, mig, and the Hurd, Justus Winter, 2013/11/29
- [PATCH 1/8] include: skip routines related to migrating threads, Justus Winter, 2013/11/28
- [PATCH 4/8] include: add msgh_protected_payload to mach_msg_header_t, Justus Winter, 2013/11/28
- [PATCH 3/8] ipc: implement mach_port_set_protected_payload, Justus Winter, 2013/11/28
- [PATCH 2/8] ipc: add protected payload, Justus Winter, 2013/11/28
- [PATCH 5/8] include: define MACH_MSG_TYPE_PROTECTED_PAYLOAD, Justus Winter, 2013/11/28
- [PATCH 6/8] ipc: provide the protected payload in ipc_kmsg_copyout_header, Justus Winter, 2013/11/28
- [PATCH 7/8] ipc: clear the payload when moving a receive port,
Justus Winter <=
- [PATCH 8/8] XXX fix the size of ipc_port structs, Justus Winter, 2013/11/28
- [PATCH 1/5] Advise flex not to generate the input function, Justus Winter, 2013/11/28
- [PATCH] Drop the auto keyword, Justus Winter, 2013/11/28
- [PATCH 4/5] Clean up generated sources, Justus Winter, 2013/11/28
- [PATCH 2/5] Avoid a compiler warning in WriteDefines, Justus Winter, 2013/11/28
- [PATCH 3/5] Add inTransPayload, Justus Winter, 2013/11/28
- [PATCH 5/5] Use inTransPayload, Justus Winter, 2013/11/28
- [PATCH 01/23] trans: fix the receiver lookup in password, Justus Winter, 2013/11/28