From: Rhys Kidd Date: Sun, 22 Feb 2015 00:42:52 +0000 (+0000) Subject: Fix bz#343523, OS X mach_ports_register: UNKNOWN task message [id 3403, to mach_task_... X-Git-Tag: svn/VALGRIND_3_11_0~640 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4094895ed618f2db991c9e3b65115297a4067ea4;p=thirdparty%2Fvalgrind.git Fix bz#343523, OS X mach_ports_register: UNKNOWN task message [id 3403, to mach_task_self(), reply 0x30f] git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14952 --- diff --git a/NEWS b/NEWS index afcfb81fea..14784fcbca 100644 --- a/NEWS +++ b/NEWS @@ -92,6 +92,8 @@ where XXXXXX is the bug number as listed below. 343306 OS X 10.10: UNKNOWN mach_msg unhandled MACH_SEND_TRAILER option 343332 Unhandled instruction 0x9E310021 (fcvtmu) on aarch64 343335 unhandled instruction 0x1E638400 (fccmp) aarch64 +343523 OS X mach_ports_register: UNKNOWN task message [id 3403, to + mach_task_self(), reply 0x30f] 343732 Unhandled syscall 144 (setgid) on aarch64 343733 Unhandled syscall 187 (msgctl and related) on aarch64 343802 s390x: Fix false positives "conditional jump or move depends on diff --git a/coregrind/m_syswrap/priv_syswrap-darwin.h b/coregrind/m_syswrap/priv_syswrap-darwin.h index 1a40633ea5..9351b81b75 100644 --- a/coregrind/m_syswrap/priv_syswrap-darwin.h +++ b/coregrind/m_syswrap/priv_syswrap-darwin.h @@ -593,6 +593,7 @@ DECL_TEMPLATE(darwin, task_get_exception_ports); DECL_TEMPLATE(darwin, semaphore_create); DECL_TEMPLATE(darwin, semaphore_destroy); DECL_TEMPLATE(darwin, task_policy_set); +DECL_TEMPLATE(darwin, mach_ports_register); DECL_TEMPLATE(darwin, mach_ports_lookup); DECL_TEMPLATE(darwin, task_threads); DECL_TEMPLATE(darwin, task_suspend); diff --git a/coregrind/m_syswrap/syswrap-darwin.c b/coregrind/m_syswrap/syswrap-darwin.c index 4da31a6523..cd4043aa5f 100644 --- a/coregrind/m_syswrap/syswrap-darwin.c +++ b/coregrind/m_syswrap/syswrap-darwin.c @@ -5781,6 +5781,46 @@ POST(task_policy_set) } } + +PRE(mach_ports_register) +{ +#pragma pack(4) + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_ports_descriptor_t init_port_set; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t init_port_setCnt; + } Request; +#pragma pack() + + // Request *req = (Request *)ARG1; + + PRINT("mach_ports_register(%s)", name_for_port(MACH_REMOTE)); + + AFTER = POST_FN(mach_ports_register); +} + +POST(mach_ports_register) +{ +#pragma pack(4) + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + } Reply; +#pragma pack() + + Reply *reply = (Reply *)ARG1; + if (!reply->RetCode) { + } else { + PRINT("mig return %d", reply->RetCode); + } +} + + PRE(mach_ports_lookup) { #pragma pack(4) @@ -7696,6 +7736,9 @@ PRE(mach_msg_task) case 3402: CALL_PRE(task_threads); return; + case 3403: + CALL_PRE(mach_ports_register); + return; case 3404: CALL_PRE(mach_ports_lookup); return;