| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "debug.h" | 5 #include "debug.h" |
| 6 #include "sandbox_impl.h" | 6 #include "sandbox_impl.h" |
| 7 | 7 |
| 8 namespace playground { | 8 namespace playground { |
| 9 | 9 |
| 10 int Sandbox::sandbox_exit(int status) { | 10 int Sandbox::sandbox_exit(int status) { |
| 11 Debug::syscall(__NR_exit, "Executing handler"); | 11 long long tm; |
| 12 Debug::syscall(&tm, __NR_exit, "Executing handler"); |
| 12 struct { | 13 struct { |
| 13 int sysnum; | 14 int sysnum; |
| 14 long long cookie; | 15 long long cookie; |
| 15 } __attribute__((packed)) request; | 16 } __attribute__((packed)) request; |
| 16 request.sysnum = __NR_exit; | 17 request.sysnum = __NR_exit; |
| 17 request.cookie = cookie(); | 18 request.cookie = cookie(); |
| 18 | 19 |
| 19 SysCalls sys; | 20 SysCalls sys; |
| 20 if (write(sys, processFdPub(), &request, sizeof(request)) != | 21 if (write(sys, processFdPub(), &request, sizeof(request)) != |
| 21 sizeof(request)) { | 22 sizeof(request)) { |
| 22 die("Failed to forward exit() request [sandbox]"); | 23 die("Failed to forward exit() request [sandbox]"); |
| 23 } | 24 } |
| 24 for (;;) { | 25 for (;;) { |
| 25 sys._exit(status); | 26 sys._exit(status); |
| 26 } | 27 } |
| 27 } | 28 } |
| 28 | 29 |
| 29 bool Sandbox::process_exit(int parentMapsFd, int sandboxFd, int threadFdPub, | 30 bool Sandbox::process_exit(int parentMapsFd, int sandboxFd, int threadFdPub, |
| 30 int threadFd, SecureMem::Args* mem) { | 31 int threadFd, SecureMem::Args* mem) { |
| 31 SecureMem::lockSystemCall(parentMapsFd, mem); | 32 SecureMem::lockSystemCall(parentMapsFd, mem); |
| 32 SecureMem::sendSystemCall(threadFdPub, true, parentMapsFd, mem, | 33 SecureMem::sendSystemCall(threadFdPub, true, parentMapsFd, mem, |
| 33 __NR_exit, 0); | 34 __NR_exit, 0); |
| 34 return true; | 35 return true; |
| 35 } | 36 } |
| 36 | 37 |
| 37 } // namespace | 38 } // namespace |
| OLD | NEW |