diff options
author | Justus Winter <4winter@informatik.uni-hamburg.de> | 2014-02-21 17:35:16 +0100 |
---|---|---|
committer | Justus Winter <4winter@informatik.uni-hamburg.de> | 2014-02-21 17:35:16 +0100 |
commit | b5bce6c001ef2acec4201af422ad0115c932a362 (patch) | |
tree | 893e533a2b6d0a6118f87f6ac1ee3014fdd88c0d | |
parent | c941a241a0ecffa9b8b8da0f2df8584e4c7de8bc (diff) |
update protected_payload.patch
-rw-r--r-- | debian/patches/protected_payload.patch | 107 |
1 files changed, 72 insertions, 35 deletions
diff --git a/debian/patches/protected_payload.patch b/debian/patches/protected_payload.patch index 18e314e..2a03e23 100644 --- a/debian/patches/protected_payload.patch +++ b/debian/patches/protected_payload.patch @@ -160,7 +160,7 @@ index f78e978..0a7297e 100644 /* * A dummy value. Mostly used to indicate that the actual value diff --git a/ipc/ipc_kmsg.c b/ipc/ipc_kmsg.c -index 0e43410..c57ed90 100644 +index 0e43410..2190e30 100644 --- a/ipc/ipc_kmsg.c +++ b/ipc/ipc_kmsg.c @@ -1802,9 +1802,17 @@ ipc_kmsg_copyout_header(msg, space, notify) @@ -170,7 +170,7 @@ index 0e43410..c57ed90 100644 - 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_has_protected_payload) { ++ if (! ipc_port_flag_protected_payload(dest)) { + msg->msgh_bits = (MACH_MSGH_BITS_OTHER(mbits) | + MACH_MSGH_BITS(0, MACH_MSG_TYPE_PORT_SEND)); + msg->msgh_local_port = dest_name; @@ -178,7 +178,7 @@ index 0e43410..c57ed90 100644 + msg->msgh_bits = (MACH_MSGH_BITS_OTHER(mbits) | + MACH_MSGH_BITS( + 0, MACH_MSG_TYPE_PROTECTED_PAYLOAD)); -+ msg->msgh_protected_payload = \ ++ msg->msgh_protected_payload = + dest->ip_protected_payload; + } msg->msgh_remote_port = MACH_PORT_NULL; @@ -192,7 +192,7 @@ index 0e43410..c57ed90 100644 - MACH_MSGH_BITS(MACH_MSG_TYPE_PORT_SEND_ONCE, - MACH_MSG_TYPE_PORT_SEND)); - msg->msgh_local_port = dest_name; -+ if (! dest->ip_has_protected_payload) { ++ if (! ipc_port_flag_protected_payload(dest)) { + msg->msgh_bits = (MACH_MSGH_BITS_OTHER(mbits) | + MACH_MSGH_BITS(MACH_MSG_TYPE_PORT_SEND_ONCE, + MACH_MSG_TYPE_PORT_SEND)); @@ -201,7 +201,7 @@ index 0e43410..c57ed90 100644 + 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 = \ ++ msg->msgh_protected_payload = + dest->ip_protected_payload; + } msg->msgh_remote_port = reply_name; @@ -214,7 +214,7 @@ index 0e43410..c57ed90 100644 - 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_has_protected_payload) { ++ if (! ipc_port_flag_protected_payload(dest)) { + msg->msgh_bits = (MACH_MSGH_BITS_OTHER(mbits) | + MACH_MSGH_BITS(0, + MACH_MSG_TYPE_PORT_SEND_ONCE)); @@ -223,7 +223,7 @@ index 0e43410..c57ed90 100644 + msg->msgh_bits = (MACH_MSGH_BITS_OTHER(mbits) | + MACH_MSGH_BITS(0, + MACH_MSG_TYPE_PROTECTED_PAYLOAD)); -+ msg->msgh_protected_payload = \ ++ msg->msgh_protected_payload = + dest->ip_protected_payload; + } msg->msgh_remote_port = MACH_PORT_NULL; @@ -236,7 +236,7 @@ index 0e43410..c57ed90 100644 - msg->msgh_bits = (MACH_MSGH_BITS_OTHER(mbits) | - MACH_MSGH_BITS(reply_type, dest_type)); - msg->msgh_local_port = dest_name; -+ if (! dest->ip_has_protected_payload) { ++ if (! ipc_port_flag_protected_payload(dest)) { + msg->msgh_bits = (MACH_MSGH_BITS_OTHER(mbits) | + MACH_MSGH_BITS(reply_type, dest_type)); + msg->msgh_local_port = dest_name; @@ -250,19 +250,34 @@ index 0e43410..c57ed90 100644 } diff --git a/ipc/ipc_object.c b/ipc/ipc_object.c -index 982bd4e..d9875d1 100644 +index 982bd4e..db6ef01 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_has_protected_payload = FALSE; ++ ipc_port_flag_protected_payload_clear(port); ip_unlock(port); break; } +diff --git a/ipc/ipc_object.h b/ipc/ipc_object.h +index adf5bca..b83bb5a 100644 +--- a/ipc/ipc_object.h ++++ b/ipc/ipc_object.h +@@ -57,7 +57,9 @@ typedef struct ipc_object { + #define IO_VALID(io) (((io) != IO_NULL) && ((io) != IO_DEAD)) + + #define IO_BITS_KOTYPE 0x0000ffff /* used by the object */ +-#define IO_BITS_OTYPE 0x7fff0000 /* determines a cache */ ++#define IO_BITS_OTYPE 0x3fff0000 /* determines a cache */ ++/* The following masks are used to store attributes of ipc ports. */ ++#define IO_BITS_PROTECTED_PAYLOAD 0x40000000 /* pp set? */ + #define IO_BITS_ACTIVE 0x80000000U /* is object alive? */ + + #define io_active(io) ((int)(io)->io_bits < 0) /* hack */ diff --git a/ipc/ipc_port.c b/ipc/ipc_port.c -index d4ade8e..0789296 100644 +index d4ade8e..7ddbd1b 100644 --- a/ipc/ipc_port.c +++ b/ipc/ipc_port.c @@ -425,6 +425,44 @@ ipc_port_set_seqno(port, seqno) @@ -283,7 +298,7 @@ index d4ade8e..0789296 100644 + + mqueue = ipc_port_lock_mqueue(port); + port->ip_protected_payload = payload; -+ port->ip_has_protected_payload = TRUE; ++ ipc_port_flag_protected_payload_set(port); + imq_unlock(mqueue); +} + @@ -301,7 +316,7 @@ index d4ade8e..0789296 100644 + ipc_mqueue_t mqueue; + + mqueue = ipc_port_lock_mqueue(port); -+ port->ip_has_protected_payload = FALSE; ++ ipc_port_flag_protected_payload_clear(port); + imq_unlock(mqueue); +} + @@ -314,7 +329,7 @@ index d4ade8e..0789296 100644 port->ip_seqno = 0; port->ip_msgcount = 0; port->ip_qlimit = MACH_PORT_QLIMIT_DEFAULT; -+ port->ip_has_protected_payload = FALSE; ++ ipc_port_flag_protected_payload_clear(port); + port->ip_protected_payload = 0; ipc_mqueue_init(&port->ip_messages); @@ -323,22 +338,23 @@ index d4ade8e..0789296 100644 /* make port be in limbo */ port->ip_receiver_name = MACH_PORT_NULL; port->ip_destination = IP_NULL; -+ port->ip_has_protected_payload = FALSE; ++ ipc_port_flag_protected_payload_clear(port); ip_unlock(port); if (!ipc_port_check_circularity(port, pdrequest)) { -@@ -1218,6 +1259,10 @@ ipc_port_print(port) +@@ -1218,6 +1259,11 @@ ipc_port_print(port) indent += 2; + iprintf("flags "); -+ printf("has_protected_payload=%d", port->ip_has_protected_payload); ++ printf("has_protected_payload=%d", ++ ipc_port_flag_protected_payload(port)); + printf("\n"); + ipc_object_print(&port->ip_object); iprintf("receiver=0x%x", port->ip_receiver); printf(", receiver_name=0x%x\n", port->ip_receiver_name); -@@ -1240,6 +1285,8 @@ ipc_port_print(port) +@@ -1240,6 +1286,8 @@ ipc_port_print(port) printf(", sndrs=0x%x", port->ip_blocked.ithq_base); printf(", kobj=0x%x\n", port->ip_kobject); @@ -348,21 +364,18 @@ index d4ade8e..0789296 100644 } diff --git a/ipc/ipc_port.h b/ipc/ipc_port.h -index 27d2e49..4c7c742 100644 +index 27d2e49..125fefc 100644 --- a/ipc/ipc_port.h +++ b/ipc/ipc_port.h -@@ -71,6 +71,10 @@ typedef unsigned int ipc_port_timestamp_t; - struct ipc_port { - struct ipc_target ip_target; - -+ /* Flags. */ -+ unsigned int ip_has_protected_payload:1; /* A pp has -+ been set. */ -+ - /* This points to the ip_target above if this port isn't on a port set; - otherwise it points to the port set's ips_target. */ - struct ipc_target *ip_cur_target; -@@ -96,6 +100,7 @@ struct ipc_port { +@@ -48,6 +48,7 @@ + #include <ipc/ipc_mqueue.h> + #include <ipc/ipc_table.h> + #include <ipc/ipc_thread.h> ++#include <ipc/ipc_object.h> + #include "ipc_target.h" + #include <mach/rpc.h> + +@@ -96,6 +97,7 @@ struct ipc_port { mach_port_msgcount_t ip_msgcount; mach_port_msgcount_t ip_qlimit; struct ipc_thread_queue ip_blocked; @@ -370,7 +383,7 @@ index 27d2e49..4c7c742 100644 }; #define ip_object ip_target.ipt_object -@@ -262,6 +267,12 @@ extern void +@@ -262,6 +264,12 @@ extern void ipc_port_set_seqno(ipc_port_t, mach_port_seqno_t); extern void @@ -383,8 +396,32 @@ index 27d2e49..4c7c742 100644 ipc_port_clear_receiver(ipc_port_t); extern void +@@ -325,4 +333,23 @@ ipc_port_dealloc_special(ipc_port_t, ipc_space_t); + #define ipc_port_release(port) \ + ipc_object_release(&(port)->ip_object) + ++extern inline boolean_t ++ipc_port_flag_protected_payload(const struct ipc_port *port) ++{ ++ return !! (port->ip_target.ipt_object.io_bits ++ & IO_BITS_PROTECTED_PAYLOAD); ++} ++ ++extern inline void ++ipc_port_flag_protected_payload_set(struct ipc_port *port) ++{ ++ port->ip_target.ipt_object.io_bits |= IO_BITS_PROTECTED_PAYLOAD; ++} ++ ++extern inline void ++ipc_port_flag_protected_payload_clear(struct ipc_port *port) ++{ ++ port->ip_target.ipt_object.io_bits &= ~IO_BITS_PROTECTED_PAYLOAD; ++} ++ + #endif /* _IPC_IPC_PORT_H_ */ diff --git a/ipc/ipc_right.c b/ipc/ipc_right.c -index 41fe3de..6b6b590 100644 +index 41fe3de..dbeacff 100644 --- a/ipc/ipc_right.c +++ b/ipc/ipc_right.c @@ -1432,6 +1432,12 @@ ipc_right_copyin( @@ -396,7 +433,7 @@ index 41fe3de..6b6b590 100644 + * Clear the protected payload field to retain + * the behavior of mach_msg. + */ -+ port->ip_has_protected_payload = FALSE; ++ ipc_port_flag_protected_payload_clear(port); ip_unlock(port); *objectp = (ipc_object_t) port; @@ -408,7 +445,7 @@ index 41fe3de..6b6b590 100644 + * Clear the protected payload field to retain + * the behavior of mach_msg. + */ -+ port->ip_has_protected_payload = FALSE; ++ ipc_port_flag_protected_payload_clear(port); + assert((bits & MACH_PORT_TYPE_RECEIVE) == 0); |