|
From: <sv...@va...> - 2015-05-31 01:59:05
|
Author: rhyskidd
Date: Sun May 31 02:58:57 2015
New Revision: 15298
Log:
Fix OS X host_get_special_port: UNKNOWN host message [id 412, to mach_host_self(), reply 0x........]
bz#343525
Before:
== 591 tests, 220 stderr failures, 14 stdout failures, 0 stderrB failures, 0 stdoutB failures, 30 post failures ==
After:
== 591 tests, 220 stderr failures, 14 stdout failures, 0 stderrB failures, 0 stdoutB failures, 30 post failures ==
Modified:
trunk/NEWS
trunk/coregrind/m_syswrap/priv_syswrap-darwin.h
trunk/coregrind/m_syswrap/syswrap-darwin.c
trunk/coregrind/pub_core_threadstate.h
Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS (original)
+++ trunk/NEWS Sun May 31 02:58:57 2015
@@ -165,6 +165,8 @@
343335 unhandled instruction 0x1E638400 (fccmp) aarch64
343523 OS X mach_ports_register: UNKNOWN task message [id 3403, to
mach_task_self(), reply 0x30f]
+343525 OS X host_get_special_port: UNKNOWN host message [id 412, to
+ mach_host_self(), reply 0x........]
343597 ppc64le: incorrect use of offseof macro
343732 Unhandled syscall 144 (setgid) on aarch64
343733 Unhandled syscall 187 (msgctl and related) on aarch64
Modified: trunk/coregrind/m_syswrap/priv_syswrap-darwin.h
==============================================================================
--- trunk/coregrind/m_syswrap/priv_syswrap-darwin.h (original)
+++ trunk/coregrind/m_syswrap/priv_syswrap-darwin.h Sun May 31 02:58:57 2015
@@ -573,6 +573,7 @@
DECL_TEMPLATE(darwin, host_get_io_master);
DECL_TEMPLATE(darwin, host_get_clock_service);
DECL_TEMPLATE(darwin, host_request_notification);
+DECL_TEMPLATE(darwin, host_get_special_port);
DECL_TEMPLATE(darwin, mach_port_type);
DECL_TEMPLATE(darwin, mach_port_extract_member);
DECL_TEMPLATE(darwin, mach_port_allocate);
Modified: trunk/coregrind/m_syswrap/syswrap-darwin.c
==============================================================================
--- trunk/coregrind/m_syswrap/syswrap-darwin.c (original)
+++ trunk/coregrind/m_syswrap/syswrap-darwin.c Sun May 31 02:58:57 2015
@@ -4963,6 +4963,115 @@
}
+PRE(host_get_special_port)
+{
+#pragma pack(4)
+ typedef struct {
+ mach_msg_header_t Head;
+ NDR_record_t NDR;
+ int node;
+ int which;
+ } Request;
+#pragma pack()
+
+ Request *req = (Request *)ARG1;
+
+ PRINT("host_get_special_port(node %d)", req->node);
+
+ switch (req->which) {
+ case HOST_PORT:
+ PRINT("host_get_special_port(%s, HOST_PORT)",
+ name_for_port(MACH_REMOTE));
+ break;
+ case HOST_PRIV_PORT:
+ PRINT("host_get_special_port(%s, HOST_PRIV_PORT)",
+ name_for_port(MACH_REMOTE));
+ break;
+ case HOST_IO_MASTER_PORT:
+ PRINT("host_get_special_port(%s, HOST_IO_MASTER_PORT)",
+ name_for_port(MACH_REMOTE));
+ break;
+ // Not provided by kernel
+ case HOST_DYNAMIC_PAGER_PORT:
+ PRINT("host_get_special_port(%s, HOST_DYNAMIC_PAGER_PORT)",
+ name_for_port(MACH_REMOTE));
+ break;
+ case HOST_AUDIT_CONTROL_PORT:
+ PRINT("host_get_special_port(%s, HOST_AUDIT_CONTROL_PORT)",
+ name_for_port(MACH_REMOTE));
+ break;
+ case HOST_USER_NOTIFICATION_PORT:
+ PRINT("host_get_special_port(%s, HOST_USER_NOTIFICATION_PORT)",
+ name_for_port(MACH_REMOTE));
+ break;
+ // ...
+
+ default:
+ PRINT("host_get_special_port(%s, %d)",
+ name_for_port(MACH_REMOTE), req->which);
+ break;
+ }
+
+ MACH_ARG(host_get_special_port.which) = req->which;
+
+ AFTER = POST_FN(host_get_special_port);
+}
+
+
+POST(host_get_special_port)
+{
+#pragma pack(4)
+ typedef struct {
+ mach_msg_header_t Head;
+ /* start of the kernel processed data */
+ mach_msg_body_t msgh_body;
+ mach_msg_port_descriptor_t port;
+ /* end of the kernel processed data */
+ } Reply;
+#pragma pack()
+
+ Reply *reply = (Reply *)ARG1;
+
+ PRINT("got port %#x ", reply->port.name);
+
+ /* The required entry in the allocated_ports list (mapping) might
+ not exist, due perhaps to broken syscall wrappers (mach__N etc).
+ Create a minimal entry so that assign_port_name below doesn't
+ cause an assertion. */
+ if (!port_exists(reply->port.name)) {
+ port_create_vanilla(reply->port.name);
+ }
+
+ switch (MACH_ARG(host_get_special_port.which)) {
+ case HOST_PORT:
+ assign_port_name(reply->port.name, "port-%p");
+ break;
+ case HOST_PRIV_PORT:
+ assign_port_name(reply->port.name, "priv-%p");
+ break;
+ case HOST_IO_MASTER_PORT:
+ assign_port_name(reply->port.name, "io-master-%p");
+ break;
+ // Not provided by kernel
+ case HOST_DYNAMIC_PAGER_PORT:
+ assign_port_name(reply->port.name, "dynamic-pager-%p");
+ break;
+ case HOST_AUDIT_CONTROL_PORT:
+ assign_port_name(reply->port.name, "audit-control-%p");
+ break;
+ case HOST_USER_NOTIFICATION_PORT:
+ assign_port_name(reply->port.name, "user-notification-%p");
+ break;
+ // ...
+
+ default:
+ assign_port_name(reply->port.name, "special-%p");
+ break;
+ }
+
+ PRINT("%s", name_for_port(reply->port.name));
+}
+
/* ---------------------------------------------------------------------
mach_msg: messages to a task
------------------------------------------------------------------ */
@@ -7739,6 +7848,10 @@
case 217:
CALL_PRE(host_request_notification);
return;
+
+ case 412:
+ CALL_PRE(host_get_special_port);
+ return;
default:
// unknown message to host self
Modified: trunk/coregrind/pub_core_threadstate.h
==============================================================================
--- trunk/coregrind/pub_core_threadstate.h (original)
+++ trunk/coregrind/pub_core_threadstate.h Sun May 31 02:58:57 2015
@@ -251,6 +251,9 @@
int which_port;
} task_get_special_port;
struct {
+ int which;
+ } host_get_special_port;
+ struct {
char *service_name;
} bootstrap_look_up;
struct {
|