summaryrefslogtreecommitdiff
path: root/ipc
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2023-11-19 09:34:35 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2023-11-19 09:35:03 +0100
commit1754dce141db6f79dbdc4f616f9d85204758b3fb (patch)
tree3403dedaf005ac69530bef607918b8857c259003 /ipc
parent383379ae770fd6a74c592006f46986320df9fa30 (diff)
ipc_entry_lookup_failed: Also write message id in bogus port warning
It may be enough to get an idea of the origin of the port without having to produce a stack trace.
Diffstat (limited to 'ipc')
-rw-r--r--ipc/ipc_kmsg.c20
-rw-r--r--ipc/ipc_space.h4
-rw-r--r--ipc/mach_msg.c8
3 files changed, 16 insertions, 16 deletions
diff --git a/ipc/ipc_kmsg.c b/ipc/ipc_kmsg.c
index 096769f2..bd843804 100644
--- a/ipc/ipc_kmsg.c
+++ b/ipc/ipc_kmsg.c
@@ -687,7 +687,7 @@ ipc_kmsg_copyin_header(
entry = ipc_entry_lookup (space, dest_name);
if (entry == IE_NULL)
{
- ipc_entry_lookup_failed (dest_name);
+ ipc_entry_lookup_failed (msg, dest_name);
goto abort_async;
}
bits = entry->ie_bits;
@@ -742,7 +742,7 @@ ipc_kmsg_copyin_header(
entry = ipc_entry_lookup (space, dest_name);
if (entry == IE_NULL)
{
- ipc_entry_lookup_failed (dest_name);
+ ipc_entry_lookup_failed (msg, dest_name);
goto abort_request;
}
bits = entry->ie_bits;
@@ -759,7 +759,7 @@ ipc_kmsg_copyin_header(
entry = ipc_entry_lookup (space, reply_name);
if (entry == IE_NULL)
{
- ipc_entry_lookup_failed (reply_name);
+ ipc_entry_lookup_failed (msg, reply_name);
goto abort_request;
}
bits = entry->ie_bits;
@@ -829,7 +829,7 @@ ipc_kmsg_copyin_header(
entry = ipc_entry_lookup (space, dest_name);
if (entry == IE_NULL)
{
- ipc_entry_lookup_failed (dest_name);
+ ipc_entry_lookup_failed (msg, dest_name);
goto abort_reply;
}
bits = entry->ie_bits;
@@ -905,7 +905,7 @@ ipc_kmsg_copyin_header(
if (((entry = ipc_entry_lookup(space, notify)) == IE_NULL) ||
((entry->ie_bits & MACH_PORT_TYPE_RECEIVE) == 0)) {
if (entry == IE_NULL)
- ipc_entry_lookup_failed (notify);
+ ipc_entry_lookup_failed (msg, notify);
is_write_unlock(space);
return MACH_SEND_INVALID_NOTIFY;
}
@@ -931,7 +931,7 @@ ipc_kmsg_copyin_header(
entry = ipc_entry_lookup(space, name);
if (entry == IE_NULL) {
- ipc_entry_lookup_failed (name);
+ ipc_entry_lookup_failed (msg, name);
goto invalid_dest;
}
@@ -1084,7 +1084,7 @@ ipc_kmsg_copyin_header(
entry = ipc_entry_lookup(space, dest_name);
if (entry == IE_NULL) {
- ipc_entry_lookup_failed (dest_name);
+ ipc_entry_lookup_failed (msg, dest_name);
goto invalid_dest;
}
@@ -1142,14 +1142,14 @@ ipc_kmsg_copyin_header(
dest_entry = ipc_entry_lookup(space, dest_name);
if (dest_entry == IE_NULL) {
- ipc_entry_lookup_failed (dest_name);
+ ipc_entry_lookup_failed (msg, dest_name);
goto invalid_dest;
}
reply_entry = ipc_entry_lookup(space, reply_name);
if (reply_entry == IE_NULL)
{
- ipc_entry_lookup_failed (reply_name);
+ ipc_entry_lookup_failed (msg, reply_name);
goto invalid_reply;
}
@@ -2117,7 +2117,7 @@ ipc_kmsg_copyout_header(
== IE_NULL) ||
((entry->ie_bits & MACH_PORT_TYPE_RECEIVE) == 0)) {
if (entry == IE_NULL)
- ipc_entry_lookup_failed (notify);
+ ipc_entry_lookup_failed (msg, notify);
is_read_unlock(space);
return MACH_RCV_INVALID_NOTIFY;
}
diff --git a/ipc/ipc_space.h b/ipc/ipc_space.h
index 22460877..9b199de3 100644
--- a/ipc/ipc_space.h
+++ b/ipc/ipc_space.h
@@ -159,11 +159,11 @@ ipc_entry_lookup(
extern volatile boolean_t mach_port_deallocate_debug;
static inline void
-ipc_entry_lookup_failed(mach_port_name_t name)
+ipc_entry_lookup_failed(mach_msg_header_t *msg, mach_port_name_t name)
{
if (name == MACH_PORT_NULL || name == MACH_PORT_DEAD)
return;
- printf("task %.*s looked up a bogus port %lu, most probably a bug.\n", (int) sizeof current_task()->name, current_task()->name, (unsigned long) name);
+ printf("task %.*s looked up a bogus port %lu for %d, most probably a bug.\n", (int) sizeof current_task()->name, current_task()->name, (unsigned long) name, msg->msgh_id);
if (mach_port_deallocate_debug)
SoftDebugger("ipc_entry_lookup");
}
diff --git a/ipc/mach_msg.c b/ipc/mach_msg.c
index abeeb643..6194ef7b 100644
--- a/ipc/mach_msg.c
+++ b/ipc/mach_msg.c
@@ -496,7 +496,7 @@ mach_msg_trap(
entry = ipc_entry_lookup (space, reply_name);
if (entry == IE_NULL)
{
- ipc_entry_lookup_failed (reply_name);
+ ipc_entry_lookup_failed (msg, reply_name);
goto abort_request_copyin;
}
reply_port = (ipc_port_t) entry->ie_object;
@@ -512,7 +512,7 @@ mach_msg_trap(
entry = ipc_entry_lookup (space, dest_name);
if (entry == IE_NULL)
{
- ipc_entry_lookup_failed (dest_name);
+ ipc_entry_lookup_failed (msg, dest_name);
goto abort_request_copyin;
}
bits = entry->ie_bits;
@@ -627,7 +627,7 @@ mach_msg_trap(
entry = ipc_entry_lookup (space, dest_name);
if (entry == IE_NULL)
{
- ipc_entry_lookup_failed (dest_name);
+ ipc_entry_lookup_failed (msg, dest_name);
goto abort_reply_dest_copyin;
}
@@ -678,7 +678,7 @@ mach_msg_trap(
entry = ipc_entry_lookup (space, rcv_name);
if (entry == IE_NULL)
{
- ipc_entry_lookup_failed (rcv_name);
+ ipc_entry_lookup_failed (msg, rcv_name);
goto abort_reply_rcv_copyin;
}
bits = entry->ie_bits;