| OLD | NEW |
| 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, |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 if (exception == EXC_CRASH && code_count >= 1) { | 190 if (exception == EXC_CRASH && code_count >= 1) { |
| 191 int signal; | 191 int signal; |
| 192 ExcCrashRecoverOriginalException(code[0], nullptr, &signal); | 192 ExcCrashRecoverOriginalException(code[0], nullptr, &signal); |
| 193 | 193 |
| 194 // The child crashed with __builtin_trap(), which shows up as SIGILL. | 194 // The child crashed with __builtin_trap(), which shows up as SIGILL. |
| 195 EXPECT_EQ(SIGILL, signal); | 195 EXPECT_EQ(SIGILL, signal); |
| 196 | 196 |
| 197 SetExpectedChildTermination(kTerminationSignal, signal); | 197 SetExpectedChildTermination(kTerminationSignal, signal); |
| 198 } | 198 } |
| 199 | 199 |
| 200 EXPECT_EQ(0, AuditPIDFromMachMessageTrailer(trailer)); |
| 201 |
| 200 return ExcServerSuccessfulReturnValue(behavior, false); | 202 return ExcServerSuccessfulReturnValue(behavior, false); |
| 201 } | 203 } |
| 202 | 204 |
| 203 private: | 205 private: |
| 204 class Child { | 206 class Child { |
| 205 public: | 207 public: |
| 206 explicit Child(TestExceptionPorts* test_exception_ports) | 208 explicit Child(TestExceptionPorts* test_exception_ports) |
| 207 : test_exception_ports_(test_exception_ports), | 209 : test_exception_ports_(test_exception_ports), |
| 208 thread_(), | 210 thread_(), |
| 209 init_semaphore_(0), | 211 init_semaphore_(0), |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 c = '\0'; | 438 c = '\0'; |
| 437 CheckedWriteFile(WritePipeHandle(), &c, 1); | 439 CheckedWriteFile(WritePipeHandle(), &c, 1); |
| 438 | 440 |
| 439 if (who_crashes_ != kNobodyCrashes) { | 441 if (who_crashes_ != kNobodyCrashes) { |
| 440 UniversalMachExcServer universal_mach_exc_server(this); | 442 UniversalMachExcServer universal_mach_exc_server(this); |
| 441 | 443 |
| 442 const mach_msg_timeout_t kTimeoutMs = 50; | 444 const mach_msg_timeout_t kTimeoutMs = 50; |
| 443 kern_return_t kr = | 445 kern_return_t kr = |
| 444 MachMessageServer::Run(&universal_mach_exc_server, | 446 MachMessageServer::Run(&universal_mach_exc_server, |
| 445 local_port, | 447 local_port, |
| 446 MACH_MSG_OPTION_NONE, | 448 kMachMessageReceiveAuditTrailer, |
| 447 MachMessageServer::kOneShot, | 449 MachMessageServer::kOneShot, |
| 448 MachMessageServer::kReceiveLargeError, | 450 MachMessageServer::kReceiveLargeError, |
| 449 kTimeoutMs); | 451 kTimeoutMs); |
| 450 EXPECT_EQ(KERN_SUCCESS, kr) | 452 EXPECT_EQ(KERN_SUCCESS, kr) |
| 451 << MachErrorMessage(kr, "MachMessageServer::Run"); | 453 << MachErrorMessage(kr, "MachMessageServer::Run"); |
| 452 | 454 |
| 453 EXPECT_TRUE(handled_); | 455 EXPECT_TRUE(handled_); |
| 454 } | 456 } |
| 455 | 457 |
| 456 // Wait for the child process to exit or terminate, as indicated by it | 458 // Wait for the child process to exit or terminate, as indicated by it |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 604 if (geteuid() == 0) { | 606 if (geteuid() == 0) { |
| 605 EXPECT_TRUE(rv); | 607 EXPECT_TRUE(rv); |
| 606 } else { | 608 } else { |
| 607 EXPECT_FALSE(rv); | 609 EXPECT_FALSE(rv); |
| 608 } | 610 } |
| 609 } | 611 } |
| 610 | 612 |
| 611 } // namespace | 613 } // namespace |
| 612 } // namespace test | 614 } // namespace test |
| 613 } // namespace crashpad | 615 } // namespace crashpad |
| OLD | NEW |