[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 09/11] ipc: provide the protected payload in ipc_kmsg_copyout_hea
From: |
Justus Winter |
Subject: |
[PATCH 09/11] ipc: provide the protected payload in ipc_kmsg_copyout_header |
Date: |
Mon, 17 Feb 2014 18:20:59 +0100 |
* ipc/ipc_kmsg.c (ipc_kmsg_copyout_header): If a protected payload is
set for the destination port, provide it in msgh_protected_payload.
---
ipc/ipc_kmsg.c | 58 +++++++++++++++++++++++++++++++++++++++++++++-------------
1 file changed, 45 insertions(+), 13 deletions(-)
diff --git a/ipc/ipc_kmsg.c b/ipc/ipc_kmsg.c
index 0e43410..aa51100 100644
--- a/ipc/ipc_kmsg.c
+++ b/ipc/ipc_kmsg.c
@@ -1802,9 +1802,17 @@ ipc_kmsg_copyout_header(msg, space, notify)
} else
ip_unlock(dest);
- msg->msgh_bits = (MACH_MSGH_BITS_OTHER(mbits) |
- MACH_MSGH_BITS(0, MACH_MSG_TYPE_PORT_SEND));
- msg->msgh_local_port = dest_name;
+ if (dest->ip_protected_payload == 0) {
+ msg->msgh_bits = (MACH_MSGH_BITS_OTHER(mbits) |
+ MACH_MSGH_BITS(0, MACH_MSG_TYPE_PORT_SEND));
+ msg->msgh_local_port = dest_name;
+ } else {
+ msg->msgh_bits = (MACH_MSGH_BITS_OTHER(mbits) |
+ MACH_MSGH_BITS(
+ 0, MACH_MSG_TYPE_PROTECTED_PAYLOAD));
+ msg->msgh_protected_payload = \
+ dest->ip_protected_payload;
+ }
msg->msgh_remote_port = MACH_PORT_NULL;
return MACH_MSG_SUCCESS;
}
@@ -1900,10 +1908,18 @@ ipc_kmsg_copyout_header(msg, space, notify)
} else
ip_unlock(dest);
- msg->msgh_bits = (MACH_MSGH_BITS_OTHER(mbits) |
- MACH_MSGH_BITS(MACH_MSG_TYPE_PORT_SEND_ONCE,
- MACH_MSG_TYPE_PORT_SEND));
- msg->msgh_local_port = dest_name;
+ if (dest->ip_protected_payload == 0) {
+ msg->msgh_bits = (MACH_MSGH_BITS_OTHER(mbits) |
+ MACH_MSGH_BITS(MACH_MSG_TYPE_PORT_SEND_ONCE,
+ MACH_MSG_TYPE_PORT_SEND));
+ msg->msgh_local_port = dest_name;
+ } else {
+ msg->msgh_bits = (MACH_MSGH_BITS_OTHER(mbits) |
+ MACH_MSGH_BITS(MACH_MSG_TYPE_PORT_SEND_ONCE,
+ MACH_MSG_TYPE_PROTECTED_PAYLOAD));
+ msg->msgh_protected_payload = \
+ dest->ip_protected_payload;
+ }
msg->msgh_remote_port = reply_name;
return MACH_MSG_SUCCESS;
}
@@ -1935,9 +1951,18 @@ ipc_kmsg_copyout_header(msg, space, notify)
dest_name = MACH_PORT_NULL;
}
- msg->msgh_bits = (MACH_MSGH_BITS_OTHER(mbits) |
- MACH_MSGH_BITS(0, MACH_MSG_TYPE_PORT_SEND_ONCE));
- msg->msgh_local_port = dest_name;
+ if (dest->ip_protected_payload == 0) {
+ msg->msgh_bits = (MACH_MSGH_BITS_OTHER(mbits) |
+ MACH_MSGH_BITS(0,
+ MACH_MSG_TYPE_PORT_SEND_ONCE));
+ msg->msgh_local_port = dest_name;
+ } else {
+ msg->msgh_bits = (MACH_MSGH_BITS_OTHER(mbits) |
+ MACH_MSGH_BITS(0,
+ MACH_MSG_TYPE_PROTECTED_PAYLOAD));
+ msg->msgh_protected_payload = \
+ dest->ip_protected_payload;
+ }
msg->msgh_remote_port = MACH_PORT_NULL;
return MACH_MSG_SUCCESS;
}
@@ -2227,9 +2252,16 @@ ipc_kmsg_copyout_header(msg, space, notify)
if (IP_VALID(reply))
ipc_port_release(reply);
- msg->msgh_bits = (MACH_MSGH_BITS_OTHER(mbits) |
- MACH_MSGH_BITS(reply_type, dest_type));
- msg->msgh_local_port = dest_name;
+ if (dest->ip_protected_payload == 0) {
+ msg->msgh_bits = (MACH_MSGH_BITS_OTHER(mbits) |
+ MACH_MSGH_BITS(reply_type, dest_type));
+ msg->msgh_local_port = dest_name;
+ } else {
+ msg->msgh_bits = (MACH_MSGH_BITS_OTHER(mbits) |
+ MACH_MSGH_BITS(reply_type,
+ MACH_MSG_TYPE_PROTECTED_PAYLOAD));
+ msg->msgh_protected_payload = dest->ip_protected_payload;
+ }
msg->msgh_remote_port = reply_name;
}
--
1.8.5.2
- Re: [PATCH 04/11] doc: document mach_port_set_protected_payload, (continued)
- [PATCH 02/11] ipc: add protected payload, Justus Winter, 2014/02/17
- [PATCH 03/11] ipc: implement mach_port_set_protected_payload, Justus Winter, 2014/02/17
- [PATCH 07/11] include: define MACH_MSG_TYPE_PROTECTED_PAYLOAD, Justus Winter, 2014/02/17
- [PATCH 08/11] doc: document MACH_MSG_TYPE_PROTECTED_PAYLOAD, Justus Winter, 2014/02/17
- [PATCH 06/11] doc: document msgh_protected_payload, Justus Winter, 2014/02/17
- [PATCH 10/11] ipc: clear the payload when moving a receive port, Justus Winter, 2014/02/17
- [PATCH 05/11] include: add msgh_protected_payload to mach_msg_header_t, Justus Winter, 2014/02/17
- [PATCH 11/11] doc: document message semantics with protected payloads, Justus Winter, 2014/02/17
- [PATCH 09/11] ipc: provide the protected payload in ipc_kmsg_copyout_header,
Justus Winter <=
- Re: protected payloads for GNU Mach, Samuel Thibault, 2014/02/19