* Functions to manipulate IPC ports.
*/
-#include <norma_vm.h>
#include <zone_debug.h>
#include <mach_assert.h>
#include <mach/port.h>
#include <mach/kern_return.h>
-#include <kern/lock.h>
#include <kern/ipc_kobject.h>
#include <kern/thread.h>
#include <kern/misc_protos.h>
#include <ipc/ipc_mqueue.h>
#include <ipc/ipc_notify.h>
#include <ipc/ipc_table.h>
+#include <ipc/ipc_importance.h>
#include <security/mac_mach_internal.h>
#include <string.h>
-decl_lck_mtx_data(, ipc_port_multiple_lock_data)
-lck_mtx_ext_t ipc_port_multiple_lock_data_ext;
+decl_lck_spin_data(, ipc_port_multiple_lock_data)
ipc_port_timestamp_t ipc_port_timestamp_data;
int ipc_portbt;
#if MACH_ASSERT
void ipc_port_init_debug(
ipc_port_t port,
- natural_t *callstack,
+ uintptr_t *callstack,
unsigned int callstack_max);
void ipc_port_callstack_init_debug(
- natural_t *callstack,
+ uintptr_t *callstack,
unsigned int callstack_max);
#endif /* MACH_ASSERT */
* KERN_NO_SPACE No index allocated.
*/
+#if IMPORTANCE_INHERITANCE
+kern_return_t
+ipc_port_request_alloc(
+ ipc_port_t port,
+ mach_port_name_t name,
+ ipc_port_t soright,
+ boolean_t send_possible,
+ boolean_t immediate,
+ ipc_port_request_index_t *indexp,
+ boolean_t *importantp)
+#else
kern_return_t
ipc_port_request_alloc(
ipc_port_t port,
boolean_t send_possible,
boolean_t immediate,
ipc_port_request_index_t *indexp)
+#endif /* IMPORTANCE_INHERITANCE */
{
ipc_port_request_t ipr, table;
ipc_port_request_index_t index;
uintptr_t mask = 0;
+#if IMPORTANCE_INHERITANCE
+ *importantp = FALSE;
+#endif /* IMPORTANCE_INHERITANCE */
+
assert(ip_active(port));
assert(name != MACH_PORT_NULL);
assert(soright != IP_NULL);
mask |= IPR_SOR_SPREQ_MASK;
if (immediate) {
mask |= IPR_SOR_SPARM_MASK;
- port->ip_sprequests = TRUE;
+ if (port->ip_sprequests == 0) {
+ port->ip_sprequests = 1;
+#if IMPORTANCE_INHERITANCE
+ /* TODO: Live importance support in send-possible */
+ if (port->ip_impdonation != 0 &&
+ port->ip_spimportant == 0 &&
+ (task_is_importance_donor(current_task()))) {
+ port->ip_spimportant = 1;
+ *importantp = TRUE;
+ }
+#endif /* IMPORTANCE_INHERTANCE */
+ }
}
}
ipr->ipr_soright = IPR_SOR_MAKE(soright, mask);
* Arm delayed send-possible request.
* Conditions:
* The port must be locked and active.
+ *
+ * Returns TRUE if the request was armed
+ * (or armed with importance in that version).
*/
-void
+#if IMPORTANCE_INHERITANCE
+boolean_t
+ipc_port_request_sparm(
+ ipc_port_t port,
+ __assert_only mach_port_name_t name,
+ ipc_port_request_index_t index,
+ mach_msg_option_t option)
+#else
+boolean_t
ipc_port_request_sparm(
ipc_port_t port,
__assert_only mach_port_name_t name,
ipc_port_request_index_t index)
+#endif /* IMPORTANCE_INHERITANCE */
{
if (index != IE_REQ_NONE) {
ipc_port_request_t ipr, table;
if (IPR_SOR_SPREQ(ipr->ipr_soright)) {
ipr->ipr_soright = IPR_SOR_MAKE(ipr->ipr_soright, IPR_SOR_SPARM_MASK);
- port->ip_sprequests = TRUE;
- }
+ port->ip_sprequests = 1;
+#if IMPORTANCE_INHERITANCE
+ if (((option & MACH_SEND_NOIMPORTANCE) == 0) &&
+ (port->ip_impdonation != 0) &&
+ (port->ip_spimportant == 0) &&
+ (((option & MACH_SEND_IMPORTANCE) != 0) ||
+ (task_is_importance_donor(current_task())))) {
+ port->ip_spimportant = 1;
+ return TRUE;
+ }
+#else
+ return TRUE;
+#endif /* IMPORTANCE_INHERITANCE */
+ }
}
+ return FALSE;
}
/*
ipc_mqueue_changed(&port->ip_messages);
ipc_port_set_mscount(port, 0);
port->ip_messages.imq_seqno = 0;
+ port->ip_context = port->ip_guarded = port->ip_strict_guard = 0;
imq_unlock(&port->ip_messages);
splx(s);
}
port->ip_premsg = IKM_NULL;
port->ip_context = 0;
+ port->ip_sprequests = 0;
+ port->ip_spimportant = 0;
+ port->ip_impdonation = 0;
+ port->ip_tempowner = 0;
+
+ port->ip_guarded = 0;
+ port->ip_strict_guard = 0;
+ port->ip_impcount = 0;
+
+ port->ip_reserved = 0;
+
ipc_mqueue_init(&port->ip_messages, FALSE /* set */);
}
kern_return_t kr;
#if MACH_ASSERT
- natural_t buf[IP_CALLSTACK_MAX];
+ uintptr_t buf[IP_CALLSTACK_MAX];
ipc_port_callstack_init_debug(&buf[0], IP_CALLSTACK_MAX);
#endif /* MACH_ASSERT */
/* unlock space after init */
is_write_unlock(space);
-#if CONFIG_MACF_MACH
- task_t issuer = current_task();
- tasklabel_lock2 (issuer, space->is_task);
- mac_port_label_associate(&issuer->maclabel, &space->is_task->maclabel,
- &port->ip_label);
- tasklabel_unlock2 (issuer, space->is_task);
-#endif
-
*namep = name;
*portp = port;
kern_return_t kr;
#if MACH_ASSERT
- natural_t buf[IP_CALLSTACK_MAX];
+ uintptr_t buf[IP_CALLSTACK_MAX];
ipc_port_callstack_init_debug(&buf[0], IP_CALLSTACK_MAX);
#endif /* MACH_ASSERT */
ipc_port_init_debug(port, &buf[0], IP_CALLSTACK_MAX);
#endif /* MACH_ASSERT */
-#if CONFIG_MACF_MACH
- task_t issuer = current_task();
- tasklabel_lock2 (issuer, space->is_task);
- mac_port_label_associate(&issuer->maclabel, &space->is_task->maclabel,
- &port->ip_label);
- tasklabel_unlock2 (issuer, space->is_task);
-#endif
-
*portp = port;
return KERN_SUCCESS;
{
ipc_port_request_index_t index = 0;
ipc_table_elems_t size = 0;
+#if IMPORTANCE_INHERITANCE
+ boolean_t dropassert = FALSE;
+#endif /* IMPORTANCE_INHERITANCE */
/*
* If the port has no send-possible request
* armed, don't bother to lock the port.
*/
- if (!port->ip_sprequests)
+ if (port->ip_sprequests == 0)
return;
ip_lock(port);
- if (!port->ip_sprequests) {
+
+#if IMPORTANCE_INHERITANCE
+ if (port->ip_spimportant != 0) {
+ port->ip_spimportant = 0;
+ if (ipc_port_impcount_delta(port, -1, IP_NULL) == -1) {
+ dropassert = TRUE;
+ }
+ }
+#endif /* IMPORTANCE_INHERITANCE */
+
+ if (port->ip_sprequests == 0) {
ip_unlock(port);
- return;
+ goto out;
}
- port->ip_sprequests = FALSE;
+ port->ip_sprequests = 0;
- revalidate:
+revalidate:
if (ip_active(port)) {
ipc_port_request_t requests;
}
}
ip_unlock(port);
+out:
+#if IMPORTANCE_INHERITANCE
+ if (dropassert == TRUE && ipc_importance_task_is_any_receiver_type(current_task()->task_imp_base)) {
+ /* drop internal assertion */
+ ipc_importance_task_drop_internal_assertion(current_task()->task_imp_base, 1);
+ }
+#endif /* IMPORTANCE_INHERITANCE */
+ return;
}
/*
ipc_mqueue_t mqueue;
ipc_kmsg_t kmsg;
+#if IMPORTANCE_INHERITANCE
+ ipc_importance_task_t release_imp_task = IIT_NULL;
+ thread_t self = current_thread();
+ boolean_t top = (self->ith_assertions == 0);
+ natural_t assertcnt = 0;
+#endif /* IMPORTANCE_INHERITANCE */
+
assert(ip_active(port));
/* port->ip_receiver_name is garbage */
/* port->ip_receiver/port->ip_destination is garbage */
assert(port->ip_pset_count == 0);
assert(port->ip_mscount == 0);
- /* first check for a backup port */
-
+ /* check for a backup port */
pdrequest = port->ip_pdrequest;
+
+#if IMPORTANCE_INHERITANCE
+ /* determine how many assertions to drop and from whom */
+ if (port->ip_tempowner != 0) {
+ assert(top);
+ release_imp_task = port->ip_imp_task;
+ if (IIT_NULL != release_imp_task) {
+ port->ip_imp_task = IIT_NULL;
+ assertcnt = port->ip_impcount;
+ }
+ /* Otherwise, nothing to drop */
+ } else {
+ assertcnt = port->ip_impcount;
+ if (pdrequest != IP_NULL)
+ /* mark in limbo for the journey */
+ port->ip_tempowner = 1;
+ }
+
+ if (top)
+ self->ith_assertions = assertcnt;
+#endif /* IMPORTANCE_INHERITANCE */
+
if (pdrequest != IP_NULL) {
/* we assume the ref for pdrequest */
port->ip_pdrequest = IP_NULL;
/* consumes our refs for port and pdrequest */
ipc_notify_port_destroyed(pdrequest, port);
- return;
+
+ goto drop_assertions;
}
/* once port is dead, we don't need to keep it locked */
port->ip_object.io_bits &= ~IO_BITS_ACTIVE;
port->ip_timestamp = ipc_port_timestamp();
+ nsrequest = port->ip_nsrequest;
/*
* If the port has a preallocated message buffer and that buffer
}
/* throw away no-senders request */
- nsrequest = port->ip_nsrequest;
if (nsrequest != IP_NULL)
ipc_notify_send_once(nsrequest); /* consumes ref */
ipc_kobject_destroy(port);
ip_release(port); /* consume caller's ref */
+
+ drop_assertions:
+#if IMPORTANCE_INHERITANCE
+ if (release_imp_task != IIT_NULL) {
+ if (assertcnt > 0) {
+ assert(top);
+ self->ith_assertions = 0;
+ assert(ipc_importance_task_is_any_receiver_type(release_imp_task));
+ ipc_importance_task_drop_internal_assertion(release_imp_task, assertcnt);
+ }
+ ipc_importance_task_release(release_imp_task);
+
+ } else if (assertcnt > 0) {
+ if (top) {
+ self->ith_assertions = 0;
+ release_imp_task = current_task()->task_imp_base;
+ if (ipc_importance_task_is_any_receiver_type(release_imp_task)) {
+ ipc_importance_task_drop_internal_assertion(release_imp_task, assertcnt);
+ }
+ }
+ }
+#endif /* IMPORTANCE_INHERITANCE */
}
/*
* That is, we want to set port->ip_destination == dest,
* but guaranteeing that this doesn't create a circle
* port->ip_destination->ip_destination->... == port
+ *
+ * Additionally, if port was successfully changed to "in transit",
+ * propagate boost assertions from the "in limbo" port to all
+ * the ports in the chain, and, if the destination task accepts
+ * boosts, to the destination task.
+ *
* Conditions:
* No ports locked. References held for "port" and "dest".
*/
{
ipc_port_t base;
+#if IMPORTANCE_INHERITANCE
+ ipc_importance_task_t imp_task = IIT_NULL;
+ ipc_importance_task_t release_imp_task = IIT_NULL;
+ int assertcnt = 0;
+#endif /* IMPORTANCE_INHERITANCE */
+
assert(port != IP_NULL);
assert(dest != IP_NULL);
ip_reference(dest);
port->ip_destination = dest;
+#if IMPORTANCE_INHERITANCE
+ /* must have been in limbo or still bound to a task */
+ assert(port->ip_tempowner != 0);
+
+ /*
+ * We delayed dropping assertions from a specific task.
+ * Cache that info now (we'll drop assertions and the
+ * task reference below).
+ */
+ release_imp_task = port->ip_imp_task;
+ if (IIT_NULL != release_imp_task) {
+ port->ip_imp_task = IIT_NULL;
+ }
+ assertcnt = port->ip_impcount;
+
+ /* take the port out of limbo w.r.t. assertions */
+ port->ip_tempowner = 0;
+
+#endif /* IMPORTANCE_INHERITANCE */
+
/* now unlock chain */
- while (port != base) {
- ipc_port_t next;
+ ip_unlock(port);
+
+ for (;;) {
+
+#if IMPORTANCE_INHERITANCE
+ /* every port along chain track assertions behind it */
+ dest->ip_impcount += assertcnt;
+#endif /* IMPORTANCE_INHERITANCE */
+
+ if (dest == base)
+ break;
/* port is in transit */
- assert(ip_active(port));
- assert(port->ip_receiver_name == MACH_PORT_NULL);
- assert(port->ip_destination != IP_NULL);
+ assert(ip_active(dest));
+ assert(dest->ip_receiver_name == MACH_PORT_NULL);
+ assert(dest->ip_destination != IP_NULL);
- next = port->ip_destination;
- ip_unlock(port);
- port = next;
+#if IMPORTANCE_INHERITANCE
+ assert(dest->ip_tempowner == 0);
+#endif /* IMPORTANCE_INHERITANCE */
+
+ port = dest->ip_destination;
+ ip_unlock(dest);
+ dest = port;
}
/* base is not in transit */
-
assert(!ip_active(base) ||
(base->ip_receiver_name != MACH_PORT_NULL) ||
(base->ip_destination == IP_NULL));
+
+#if IMPORTANCE_INHERITANCE
+ /*
+ * Find the task to boost (if any).
+ * We will boost "through" ports that don't know
+ * about inheritance to deliver receive rights that
+ * do.
+ */
+ if (ip_active(base) && (assertcnt > 0)) {
+ if (base->ip_tempowner != 0) {
+ if (IIT_NULL != base->ip_imp_task) {
+ /* specified tempowner task */
+ imp_task = base->ip_imp_task;
+ assert(ipc_importance_task_is_any_receiver_type(imp_task));
+ }
+ /* otherwise don't boost current task */
+
+ } else if (base->ip_receiver_name != MACH_PORT_NULL) {
+ ipc_space_t space = base->ip_receiver;
+
+ /* only spaces with boost-accepting tasks */
+ if (space->is_task != TASK_NULL &&
+ ipc_importance_task_is_any_receiver_type(space->is_task->task_imp_base))
+ imp_task = space->is_task->task_imp_base;
+ }
+
+ /* take reference before unlocking base */
+ if (imp_task != IIT_NULL) {
+ ipc_importance_task_reference(imp_task);
+ }
+ }
+#endif /* IMPORTANCE_INHERITANCE */
+
ip_unlock(base);
+#if IMPORTANCE_INHERITANCE
+ /*
+ * Transfer assertions now that the ports are unlocked.
+ * Avoid extra overhead if transferring to/from the same task.
+ */
+ boolean_t transfer_assertions = (imp_task != release_imp_task) ? TRUE : FALSE;
+
+ if (imp_task != IIT_NULL) {
+ if (transfer_assertions)
+ ipc_importance_task_hold_internal_assertion(imp_task, assertcnt);
+ ipc_importance_task_release(imp_task);
+ imp_task = IIT_NULL;
+ }
+
+ if (release_imp_task != IIT_NULL) {
+ if (transfer_assertions)
+ ipc_importance_task_drop_internal_assertion(release_imp_task, assertcnt);
+ ipc_importance_task_release(release_imp_task);
+ release_imp_task = IIT_NULL;
+ }
+#endif /* IMPORTANCE_INHERITANCE */
+
return FALSE;
}
+/*
+ * Routine: ipc_port_impcount_delta
+ * Purpose:
+ * Adjust only the importance count associated with a port.
+ * If there are any adjustments to be made to receiver task,
+ * those are handled elsewhere.
+ *
+ * For now, be defensive during deductions to make sure the
+ * impcount for the port doesn't underflow zero. This will
+ * go away when the port boost addition is made atomic (see
+ * note in ipc_port_importance_delta()).
+ * Conditions:
+ * The port is referenced and locked.
+ * Nothing else is locked.
+ */
+mach_port_delta_t
+ipc_port_impcount_delta(
+ ipc_port_t port,
+ mach_port_delta_t delta,
+ ipc_port_t __unused base)
+{
+ mach_port_delta_t absdelta;
+
+ if (!ip_active(port)) {
+ return 0;
+ }
+
+ /* adding/doing nothing is easy */
+ if (delta >= 0) {
+ port->ip_impcount += delta;
+ return delta;
+ }
+
+ absdelta = 0 - delta;
+ //assert(port->ip_impcount >= absdelta);
+ /* if we have enough to deduct, we're done */
+ if (port->ip_impcount >= absdelta) {
+ port->ip_impcount -= absdelta;
+ return delta;
+ }
+
+#if DEVELOPMENT || DEBUG
+ if (port->ip_receiver_name != MACH_PORT_NULL) {
+ task_t target_task = port->ip_receiver->is_task;
+ ipc_importance_task_t target_imp = target_task->task_imp_base;
+ const char *target_procname;
+ int target_pid;
+
+ if (target_imp != IIT_NULL) {
+ target_procname = target_imp->iit_procname;
+ target_pid = target_imp->iit_bsd_pid;
+ } else {
+ target_procname = "unknown";
+ target_pid = -1;
+ }
+ printf("Over-release of importance assertions for port 0x%x receiver pid %d (%s), "
+ "dropping %d assertion(s) but port only has %d remaining.\n",
+ port->ip_receiver_name,
+ target_imp->iit_bsd_pid, target_imp->iit_procname,
+ absdelta, port->ip_impcount);
+
+ } else if (base != IP_NULL) {
+ task_t target_task = base->ip_receiver->is_task;
+ ipc_importance_task_t target_imp = target_task->task_imp_base;
+ const char *target_procname;
+ int target_pid;
+
+ if (target_imp != IIT_NULL) {
+ target_procname = target_imp->iit_procname;
+ target_pid = target_imp->iit_bsd_pid;
+ } else {
+ target_procname = "unknown";
+ target_pid = -1;
+ }
+ printf("Over-release of importance assertions for port %p "
+ "enqueued on port 0x%x with receiver pid %d (%s), "
+ "dropping %d assertion(s) but port only has %d remaining.\n",
+ port, base->ip_receiver_name,
+ target_imp->iit_bsd_pid, target_imp->iit_procname,
+ absdelta, port->ip_impcount);
+ }
+#endif
+ delta = 0 - port->ip_impcount;
+ port->ip_impcount = 0;
+ return delta;
+}
+
+/*
+ * Routine: ipc_port_importance_delta_internal
+ * Purpose:
+ * Adjust the importance count through the given port.
+ * If the port is in transit, apply the delta throughout
+ * the chain. Determine if the there is a task at the
+ * base of the chain that wants/needs to be adjusted,
+ * and if so, apply the delta.
+ * Conditions:
+ * The port is referenced and locked on entry.
+ * Nothing else is locked.
+ * The lock may be dropped on exit.
+ * Returns TRUE if lock was dropped.
+ */
+#if IMPORTANCE_INHERITANCE
+
+boolean_t
+ipc_port_importance_delta_internal(
+ ipc_port_t port,
+ mach_port_delta_t *deltap,
+ ipc_importance_task_t *imp_task)
+{
+ ipc_port_t next, base;
+ boolean_t dropped = FALSE;
+
+ *imp_task = IIT_NULL;
+
+ if (*deltap == 0)
+ return FALSE;
+
+ base = port;
+
+ /* if port is in transit, have to search for end of chain */
+ if (ip_active(port) &&
+ port->ip_destination != IP_NULL &&
+ port->ip_receiver_name == MACH_PORT_NULL) {
+
+ dropped = TRUE;
+
+ ip_unlock(port);
+ ipc_port_multiple_lock(); /* massive serialization */
+ ip_lock(base);
+
+ while(ip_active(base) &&
+ base->ip_destination != IP_NULL &&
+ base->ip_receiver_name == MACH_PORT_NULL) {
+
+ base = base->ip_destination;
+ ip_lock(base);
+ }
+ ipc_port_multiple_unlock();
+ }
+
+ /* unlock down to the base, adding a boost at each level */
+ for (;;) {
+ /*
+ * JMM TODO - because of the port unlock to grab the multiple lock
+ * above, a subsequent drop of importance could race and beat
+ * the "previous" increase - causing the port impcount to go
+ * negative briefly. The defensive deduction performed by
+ * ipc_port_impcount_delta() defeats that, and therefore can
+ * cause an importance leak once the increase finally arrives.
+ *
+ * Need to rework the importance delta logic to be more like
+ * ipc_importance_inherit_from() where it locks all it needs in
+ * one pass to avoid any lock drops - to keep that race from
+ * ever occuring.
+ */
+ *deltap = ipc_port_impcount_delta(port, *deltap, base);
+
+ if (port == base) {
+ break;
+ }
+
+ /* port is in transit */
+ assert(port->ip_tempowner == 0);
+ next = port->ip_destination;
+ ip_unlock(port);
+ port = next;
+ }
+
+ /* find the task (if any) to boost according to the base */
+ if (ip_active(base)) {
+ if (base->ip_tempowner != 0) {
+ if (IIT_NULL != base->ip_imp_task)
+ *imp_task = base->ip_imp_task;
+ /* otherwise don't boost */
+
+ } else if (base->ip_receiver_name != MACH_PORT_NULL) {
+ ipc_space_t space = base->ip_receiver;
+
+ /* only spaces with boost-accepting tasks */
+ if (space->is_task != TASK_NULL &&
+ ipc_importance_task_is_any_receiver_type(space->is_task->task_imp_base)) {
+ *imp_task = space->is_task->task_imp_base;
+ }
+ }
+ }
+
+ /*
+ * Only the base is locked. If we have to hold or drop task
+ * importance assertions, we'll have to drop that lock as well.
+ */
+ if (*imp_task != IIT_NULL) {
+ /* take a reference before unlocking base */
+ ipc_importance_task_reference(*imp_task);
+ }
+
+ if (dropped == TRUE) {
+ ip_unlock(base);
+ }
+
+ return dropped;
+}
+#endif /* IMPORTANCE_INHERITANCE */
+
+/*
+ * Routine: ipc_port_importance_delta
+ * Purpose:
+ * Adjust the importance count through the given port.
+ * If the port is in transit, apply the delta throughout
+ * the chain.
+ *
+ * If there is a task at the base of the chain that wants/needs
+ * to be adjusted, apply the delta.
+ * Conditions:
+ * The port is referenced and locked on entry.
+ * Nothing else is locked.
+ * The lock may be dropped on exit.
+ * Returns TRUE if lock was dropped.
+ */
+#if IMPORTANCE_INHERITANCE
+
+boolean_t
+ipc_port_importance_delta(
+ ipc_port_t port,
+ mach_port_delta_t delta)
+{
+ ipc_importance_task_t imp_task = IIT_NULL;
+ boolean_t dropped;
+
+ dropped = ipc_port_importance_delta_internal(port, &delta, &imp_task);
+
+ if (IIT_NULL == imp_task)
+ return dropped;
+
+ if (!dropped) {
+ dropped = TRUE;
+ ip_unlock(port);
+ }
+
+ assert(ipc_importance_task_is_any_receiver_type(imp_task));
+
+ if (delta > 0)
+ ipc_importance_task_hold_internal_assertion(imp_task, delta);
+ else
+ ipc_importance_task_drop_internal_assertion(imp_task, -delta);
+
+ ipc_importance_task_release(imp_task);
+ return dropped;
+}
+#endif /* IMPORTANCE_INHERITANCE */
+
/*
* Routine: ipc_port_lookup_notify
* Purpose:
port->ip_mscount++;
port->ip_srights++;
ip_reference(port);
- ip_unlock(port);
return port;
}
ip_lock(port);
+ assert(port->ip_srights > 0);
+ port->ip_srights--;
+
if (!ip_active(port)) {
ip_unlock(port);
ip_release(port);
return;
}
- assert(port->ip_srights > 0);
-
- if (--port->ip_srights == 0 &&
+ if (port->ip_srights == 0 &&
port->ip_nsrequest != IP_NULL) {
nsrequest = port->ip_nsrequest;
port->ip_nsrequest = IP_NULL;
return IP_NULL;
#if MACH_ASSERT
- natural_t buf[IP_CALLSTACK_MAX];
+ uintptr_t buf[IP_CALLSTACK_MAX];
ipc_port_callstack_init_debug(&buf[0], IP_CALLSTACK_MAX);
#endif /* MACH_ASSERT */
ipc_port_init_debug(port, &buf[0], IP_CALLSTACK_MAX);
#endif /* MACH_ASSERT */
-#if CONFIG_MACF_MACH
- /* Currently, ipc_port_alloc_special is used for two things:
- * - Reply ports for messages from the kernel
- * - Ports for communication with the kernel (e.g. task ports)
- * Since both of these would typically be labelled as kernel objects,
- * we will use a new entry point for this purpose, as current_task()
- * is often wrong (i.e. not kernel_task) or null.
- */
- mac_port_label_init(&port->ip_label);
- mac_port_label_associate_kernel(&port->ip_label, space == ipc_space_reply);
-#endif
-
return port;
}
#if MACH_ASSERT
ipc_port_track_dealloc(port);
#endif /* MACH_ASSERT */
-
-#if CONFIG_MACF_MACH
- /* Port label should have been initialized after creation. */
- mac_port_label_destroy(&port->ip_label);
-#endif
}
#if MACH_ASSERT
void
ipc_port_init_debug(
ipc_port_t port,
- natural_t *callstack,
+ uintptr_t *callstack,
unsigned int callstack_max)
{
unsigned int i;
*/
void
ipc_port_callstack_init_debug(
- natural_t *callstack,
+ uintptr_t *callstack,
unsigned int callstack_max)
{
unsigned int i;