Changeset 230045 in webkit
- Timestamp:
- Mar 28, 2018 1:43:10 PM (6 years ago)
- Location:
- trunk/Source
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r230041 r230045 1 2018-03-28 Brent Fulgham <bfulgham@apple.com> 2 3 Protect against invalid mach ports returned by mach_port_request_notification 4 https://bugs.webkit.org/show_bug.cgi?id=184106 5 <rdar://problem/37865316> 6 7 Reviewed by Chris Dumez. 8 9 * Platform/IPC/Connection.h: 10 (IPC::Connection::Identifier::Identifier): Use default initializer syntax. 11 * Platform/IPC/mac/ConnectionMac.mm: 12 (IPC::Connection::open): Drive-by-fix: Include formatted mach error message in logging. 13 (IPC::Connection::receiveSourceEventHandler): Check return value from 'mach_port_request_notification' 14 and clean up if it experienced an error. 15 * UIProcess/Launcher/mac/ProcessLauncherMac.mm: 16 (WebKit::ProcessLauncher::launchProcess): Ditto. 17 1 18 2018-03-28 Dean Jackson <dino@apple.com> 2 19 -
trunk/Source/WebKit/Platform/IPC/Connection.h
r230035 r230045 1 1 /* 2 * Copyright (C) 2010-201 6Apple Inc. All rights reserved.2 * Copyright (C) 2010-2018 Apple Inc. All rights reserved. 3 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 4 4 * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved. … … 117 117 struct Identifier { 118 118 Identifier() 119 : port(MACH_PORT_NULL)120 119 { 121 120 } … … 132 131 } 133 132 134 mach_port_t port ;133 mach_port_t port { MACH_PORT_NULL }; 135 134 OSObjectPtr<xpc_connection_t> xpcConnection; 136 135 }; -
trunk/Source/WebKit/Platform/IPC/mac/ConnectionMac.mm
r230035 r230045 187 187 auto kr = mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &m_receivePort); 188 188 if (kr != KERN_SUCCESS) { 189 LOG_ERROR("Could not allocate mach port, error %x ", kr);189 LOG_ERROR("Could not allocate mach port, error %x: %s", kr, mach_error_string(kr)); 190 190 CRASH(); 191 191 } … … 534 534 if (m_sendPort) { 535 535 mach_port_t previousNotificationPort = MACH_PORT_NULL; 536 mach_port_request_notification(mach_task_self(), m_receivePort, MACH_NOTIFY_NO_SENDERS, 0, MACH_PORT_NULL, MACH_MSG_TYPE_MOVE_SEND_ONCE, &previousNotificationPort); 536 auto kr = mach_port_request_notification(mach_task_self(), m_receivePort, MACH_NOTIFY_NO_SENDERS, 0, MACH_PORT_NULL, MACH_MSG_TYPE_MOVE_SEND_ONCE, &previousNotificationPort); 537 ASSERT(kr == KERN_SUCCESS); 538 if (kr != KERN_SUCCESS) { 539 // If mach_port_request_notification fails, 'previousNotificationPort' will be uninitialized. 540 LOG_ERROR("mach_port_request_notification failed: (%x) %s", kr, mach_error_string(kr)); 541 previousNotificationPort = MACH_PORT_NULL; 542 } 537 543 538 544 if (previousNotificationPort != MACH_PORT_NULL) -
trunk/Source/WebKit/UIProcess/Launcher/mac/ProcessLauncherMac.mm
r230035 r230045 154 154 auto kr = mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &listeningPort); 155 155 if (kr != KERN_SUCCESS) { 156 LOG_ERROR("Could not allocate mach port, error %x ", kr);156 LOG_ERROR("Could not allocate mach port, error %x: %s", kr, mach_error_string(kr)); 157 157 CRASH(); 158 158 } … … 161 161 mach_port_insert_right(mach_task_self(), listeningPort, listeningPort, MACH_MSG_TYPE_MAKE_SEND); 162 162 163 mach_port_t previousNotificationPort ;164 mach_port_request_notification(mach_task_self(), listeningPort, MACH_NOTIFY_NO_SENDERS, 0, listeningPort, MACH_MSG_TYPE_MAKE_SEND_ONCE, &previousNotificationPort);163 mach_port_t previousNotificationPort = MACH_PORT_NULL; 164 auto mc = mach_port_request_notification(mach_task_self(), listeningPort, MACH_NOTIFY_NO_SENDERS, 0, listeningPort, MACH_MSG_TYPE_MAKE_SEND_ONCE, &previousNotificationPort); 165 165 ASSERT(!previousNotificationPort); 166 ASSERT(mc == KERN_SUCCESS); 167 if (mc != KERN_SUCCESS) { 168 // If mach_port_request_notification fails, 'previousNotificationPort' will be uninitialized. 169 LOG_ERROR("mach_port_request_notification failed: (%x) %s", mc, mach_error_string(mc)); 170 } 166 171 167 172 String clientIdentifier; -
trunk/Source/WebKitLegacy/mac/ChangeLog
r230035 r230045 1 2018-03-28 Brent Fulgham <bfulgham@apple.com> 2 3 Protect against invalid mach ports returned by mach_port_request_notification 4 https://bugs.webkit.org/show_bug.cgi?id=184106 5 <rdar://problem/37865316> 6 7 Reviewed by Chris Dumez. 8 9 * Plugins/Hosted/NetscapePluginHostProxy.mm: 10 (WebKit::NetscapePluginHostProxy::NetscapePluginHostProxy): Check return value from 'mach_port_request_notification' 11 and clean up if it experienced an error. 12 (WebKit::NetscapePluginHostProxy::processRequests): Drive-by-fix: Include formatted mach error message in logging. 13 1 14 2018-03-28 Brent Fulgham <bfulgham@apple.com> 2 15 -
trunk/Source/WebKitLegacy/mac/Plugins/Hosted/NetscapePluginHostProxy.mm
r230035 r230045 112 112 113 113 mach_port_t previous = MACH_PORT_NULL; 114 mach_port_request_notification(mach_task_self(), pluginHostPort, MACH_NOTIFY_DEAD_NAME, 0,115 114 auto kr = mach_port_request_notification(mach_task_self(), pluginHostPort, MACH_NOTIFY_DEAD_NAME, 0, 115 CFMachPortGetPort(m_deadNameNotificationPort.get()), MACH_MSG_TYPE_MAKE_SEND_ONCE, &previous); 116 116 ASSERT(previous == MACH_PORT_NULL); 117 117 ASSERT(kr == KERN_SUCCESS); 118 if (kr != KERN_SUCCESS) { 119 // If mach_port_request_notification fails, 'previous' will be uninitialized. 120 LOG_ERROR("mach_port_request_notification failed: (%x) %s", kr, mach_error_string(kr)); 121 previous = MACH_PORT_NULL; 122 } 123 118 124 RetainPtr<CFRunLoopSourceRef> deathPortSource = adoptCF(CFMachPortCreateRunLoopSource(0, m_deadNameNotificationPort.get(), 0)); 119 125 … … 285 291 auto kr = mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_PORT_SET, &m_portSet); 286 292 if (kr != KERN_SUCCESS) { 287 LOG_ERROR("Could not allocate mach port, error %x ", kr);293 LOG_ERROR("Could not allocate mach port, error %x: %s", kr, mach_error_string(kr)); 288 294 CRASH(); 289 295 } … … 299 305 300 306 if (kr != KERN_SUCCESS) { 301 LOG_ERROR("Could not receive mach message, error %x ", kr);307 LOG_ERROR("Could not receive mach message, error %x: %s", kr, mach_error_string(kr)); 302 308 s_processingRequests--; 303 309 return false; … … 312 318 313 319 if (kr != KERN_SUCCESS) { 314 LOG_ERROR("Could not send mach message, error %x ", kr);320 LOG_ERROR("Could not send mach message, error %x: %s", kr, mach_error_string(kr)); 315 321 s_processingRequests--; 316 322 return false;
Note: See TracChangeset
for help on using the changeset viewer.