Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(421)

Side by Side Diff: handler/mac/exception_handler_server.cc

Issue 1001943002: handler/mac: Log a warning when an exception message has a suspicious (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: MACH_MSG_TYPE_MAKE_SEND_ONCE Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « handler/mac/crash_report_exception_handler.cc ('k') | util/mach/exception_ports_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Crashpad Authors. All rights reserved. 1 // Copyright 2014 The Crashpad Authors. All rights reserved.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and 12 // See the License for the specific language governing permissions and
13 // limitations under the License. 13 // limitations under the License.
14 14
15 #include "handler/mac/exception_handler_server.h" 15 #include "handler/mac/exception_handler_server.h"
16 16
17 #include "base/logging.h" 17 #include "base/logging.h"
18 #include "base/mac/mach_logging.h" 18 #include "base/mac/mach_logging.h"
19 #include "util/mach/composite_mach_message_server.h" 19 #include "util/mach/composite_mach_message_server.h"
20 #include "util/mach/mach_extensions.h" 20 #include "util/mach/mach_extensions.h"
21 #include "util/mach/mach_message.h" 21 #include "util/mach/mach_message.h"
22 #include "util/mach/mach_message_server.h" 22 #include "util/mach/mach_message_server.h"
23 #include "util/mach/notify_server.h" 23 #include "util/mach/notify_server.h"
24 24
25 namespace crashpad { 25 namespace crashpad {
26 26
27 namespace { 27 namespace {
28 28
29 class ExceptionHandlerServerRun 29 class ExceptionHandlerServerRun : public UniversalMachExcServer::Interface,
30 : public UniversalMachExcServer::Interface, 30 public NotifyServer::Interface {
31 public NotifyServer::Interface {
32 public: 31 public:
33 ExceptionHandlerServerRun( 32 ExceptionHandlerServerRun(
34 mach_port_t exception_port, 33 mach_port_t exception_port,
35 UniversalMachExcServer::Interface* exception_interface) 34 UniversalMachExcServer::Interface* exception_interface)
36 : UniversalMachExcServer::Interface(), 35 : UniversalMachExcServer::Interface(),
37 NotifyServer::Interface(), 36 NotifyServer::Interface(),
38 mach_exc_server_(this), 37 mach_exc_server_(this),
39 notify_server_(this), 38 notify_server_(this),
40 composite_mach_message_server_(), 39 composite_mach_message_server_(),
41 exception_interface_(exception_interface), 40 exception_interface_(exception_interface),
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 92
94 // Run the server in kOneShot mode so that running_ can be reevaluated after 93 // Run the server in kOneShot mode so that running_ can be reevaluated after
95 // each message. Receipt of a valid no-senders notification causes it to be 94 // each message. Receipt of a valid no-senders notification causes it to be
96 // set to false. 95 // set to false.
97 while (running_) { 96 while (running_) {
98 // This will result in a call to CatchMachException() or 97 // This will result in a call to CatchMachException() or
99 // DoMachNotifyNoSenders() as appropriate. 98 // DoMachNotifyNoSenders() as appropriate.
100 mach_msg_return_t mr = 99 mach_msg_return_t mr =
101 MachMessageServer::Run(&composite_mach_message_server_, 100 MachMessageServer::Run(&composite_mach_message_server_,
102 server_port_set, 101 server_port_set,
103 MACH_MSG_OPTION_NONE, 102 kMachMessageReceiveAuditTrailer,
104 MachMessageServer::kOneShot, 103 MachMessageServer::kOneShot,
105 MachMessageServer::kReceiveLargeIgnore, 104 MachMessageServer::kReceiveLargeIgnore,
106 kMachMessageTimeoutWaitIndefinitely); 105 kMachMessageTimeoutWaitIndefinitely);
107 MACH_CHECK(mr == MACH_MSG_SUCCESS, mr) << "MachMessageServer::Run"; 106 MACH_CHECK(mr == MACH_MSG_SUCCESS, mr) << "MachMessageServer::Run";
108 } 107 }
109 } 108 }
110 109
111 // UniversalMachExcServer::Interface: 110 // UniversalMachExcServer::Interface:
112 111
113 kern_return_t CatchMachException(exception_behavior_t behavior, 112 kern_return_t CatchMachException(exception_behavior_t behavior,
(...skipping 27 matching lines...) Expand all
141 old_state_count, 140 old_state_count,
142 new_state, 141 new_state,
143 new_state_count, 142 new_state_count,
144 trailer, 143 trailer,
145 destroy_complex_request); 144 destroy_complex_request);
146 } 145 }
147 146
148 // NotifyServer::Interface: 147 // NotifyServer::Interface:
149 148
150 kern_return_t DoMachNotifyPortDeleted( 149 kern_return_t DoMachNotifyPortDeleted(
151 notify_port_t notify, 150 notify_port_t notify,
152 mach_port_name_t name, 151 mach_port_name_t name,
153 const mach_msg_trailer_t* trailer) override { 152 const mach_msg_trailer_t* trailer) override {
154 return UnimplementedNotifyRoutine(notify); 153 return UnimplementedNotifyRoutine(notify);
155 } 154 }
156 155
157 kern_return_t DoMachNotifyPortDestroyed(notify_port_t notify, 156 kern_return_t DoMachNotifyPortDestroyed(notify_port_t notify,
158 mach_port_t rights, 157 mach_port_t rights,
159 const mach_msg_trailer_t* trailer, 158 const mach_msg_trailer_t* trailer,
160 bool* destroy_request) override { 159 bool* destroy_request) override {
161 *destroy_request = true; 160 *destroy_request = true;
162 return UnimplementedNotifyRoutine(notify); 161 return UnimplementedNotifyRoutine(notify);
163 } 162 }
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 ExceptionHandlerServer::~ExceptionHandlerServer() { 227 ExceptionHandlerServer::~ExceptionHandlerServer() {
229 } 228 }
230 229
231 void ExceptionHandlerServer::Run( 230 void ExceptionHandlerServer::Run(
232 UniversalMachExcServer::Interface* exception_interface) { 231 UniversalMachExcServer::Interface* exception_interface) {
233 ExceptionHandlerServerRun run(receive_port_, exception_interface); 232 ExceptionHandlerServerRun run(receive_port_, exception_interface);
234 run.Run(); 233 run.Run();
235 } 234 }
236 235
237 } // namespace crashpad 236 } // namespace crashpad
OLDNEW
« no previous file with comments | « handler/mac/crash_report_exception_handler.cc ('k') | util/mach/exception_ports_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698