| 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 long Sandbox::sandbox_mprotect(const void *addr, size_t len, int prot) { | 10 long Sandbox::sandbox_mprotect(const void *addr, size_t len, int prot) { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 | 34 |
| 35 // Cannot change permissions on any memory region that was part of the | 35 // Cannot change permissions on any memory region that was part of the |
| 36 // original memory mappings. | 36 // original memory mappings. |
| 37 if (isRegionProtected((void *) mprotect_req.addr, mprotect_req.len)) { | 37 if (isRegionProtected((void *) mprotect_req.addr, mprotect_req.len)) { |
| 38 SecureMem::abandonSystemCall(*info, -EINVAL); | 38 SecureMem::abandonSystemCall(*info, -EINVAL); |
| 39 return false; | 39 return false; |
| 40 } | 40 } |
| 41 | 41 |
| 42 // Changing permissions on memory regions that were newly mapped inside of | 42 // Changing permissions on memory regions that were newly mapped inside of |
| 43 // the sandbox is OK. | 43 // the sandbox is OK. |
| 44 SecureMem::sendSystemCall(*info, SecureMem::SEND_UNLOCKED, mprotect_req.addr, | 44 SecureMem::sendSystemCall(*info, SecureMem::SEND_UNLOCKED, |
| 45 const_cast<void*>(mprotect_req.addr), |
| 45 mprotect_req.len, mprotect_req.prot); | 46 mprotect_req.len, mprotect_req.prot); |
| 46 return true; | 47 return true; |
| 47 } | 48 } |
| 48 | 49 |
| 49 } // namespace | 50 } // namespace |
| OLD | NEW |