[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 6/8] ipc: provide the protected payload in ipc_kmsg_copyout_heade
From: |
Justus Winter |
Subject: |
[PATCH 6/8] ipc: provide the protected payload in ipc_kmsg_copyout_header |
Date: |
Fri, 29 Nov 2013 01:00:38 +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 3bdd6b0..3934f18 100644
--- a/ipc/ipc_kmsg.c
+++ b/ipc/ipc_kmsg.c
@@ -1806,9 +1806,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;
}
@@ -1904,10 +1912,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;
}
@@ -1939,9 +1955,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;
}
@@ -2231,9 +2256,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.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 <=
- [PATCH 7/8] ipc: clear the payload when moving a receive port, Justus Winter, 2013/11/28
- [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