From f67ebd0771424181f8713f1931ee221d306eb683 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Mon, 21 Dec 2009 23:10:45 +0100 Subject: Invoke debugger on duplicate port deallocation * ipc/mach_port.c (mach_port_deallocate): Call SoftDebugger if ipc_right_lookup_write was not succcessful and `name' is not MACH_PORT_NULL or MACH_PORT_DEAD. --- ipc/mach_port.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ipc/mach_port.c b/ipc/mach_port.c index 17aaf88..4315e80 100644 --- a/ipc/mach_port.c +++ b/ipc/mach_port.c @@ -602,8 +602,13 @@ mach_port_deallocate( return KERN_INVALID_TASK; kr = ipc_right_lookup_write(space, name, &entry); - if (kr != KERN_SUCCESS) + if (kr != KERN_SUCCESS) { + if (name != MACH_PORT_NULL && name != MACH_PORT_DEAD) { + printf("task %p deallocating an invalid port %u, most probably a bug.\n", current_task(), name); + SoftDebugger("mach_port_deallocate"); + } return kr; + } /* space is write-locked */ kr = ipc_right_dealloc(space, name, entry); /* unlocks space */ -- cgit v1.2.3