| 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 #ifndef SECURE_MEM_H__ | 5 #ifndef SECURE_MEM_H__ |
| 6 #define SECURE_MEM_H__ | 6 #define SECURE_MEM_H__ |
| 7 | 7 |
| 8 #include <stdlib.h> | 8 #include <stdlib.h> |
| 9 | 9 |
| 10 namespace playground { | 10 namespace playground { |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 // for unrestricted system calls. | 94 // for unrestricted system calls. |
| 95 long tmpSyscallNum; | 95 long tmpSyscallNum; |
| 96 void* tmpArg1; | 96 void* tmpArg1; |
| 97 void* tmpArg2; | 97 void* tmpArg2; |
| 98 void* tmpArg3; | 98 void* tmpArg3; |
| 99 void* tmpArg4; | 99 void* tmpArg4; |
| 100 void* tmpArg5; | 100 void* tmpArg5; |
| 101 void* tmpArg6; | 101 void* tmpArg6; |
| 102 void* tmpReturnValue; | 102 void* tmpReturnValue; |
| 103 | 103 |
| 104 // Scratch space used to return the result of a rdtsc instruction |
| 105 int rdtscpEax; |
| 106 int rdtscpEdx; |
| 107 int rdtscpEcx; |
| 108 |
| 104 // We often have long sequences of calls to gettimeofday(). This is | 109 // We often have long sequences of calls to gettimeofday(). This is |
| 105 // needlessly expensive. Coalesce them into a single call. | 110 // needlessly expensive. Coalesce them into a single call. |
| 106 long lastSyscallNum; | 111 int lastSyscallNum; |
| 107 int gettimeofdayCounter; | 112 int gettimeofdayCounter; |
| 113 |
| 114 // For debugging purposes, we want to be able to log messages. This can |
| 115 // result in additional system calls. Make sure that we don't trigger |
| 116 // logging of those recursive calls. |
| 117 int recursionLevel; |
| 108 } __attribute__((packed)); | 118 } __attribute__((packed)); |
| 109 char scratchPage[4096]; | 119 char scratchPage[4096]; |
| 110 }; | 120 }; |
| 111 } __attribute__((packed)) Args; | 121 } __attribute__((packed)) Args; |
| 112 | 122 |
| 113 // Allows the trusted process to check whether the parent process still | 123 // Allows the trusted process to check whether the parent process still |
| 114 // exists. If it doesn't, kill the trusted process. | 124 // exists. If it doesn't, kill the trusted process. |
| 115 static void dieIfParentDied(int parentProc); | 125 static void dieIfParentDied(int parentProc); |
| 116 | 126 |
| 117 // The trusted process received a system call that it intends to deny. | 127 // The trusted process received a system call that it intends to deny. |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 static void sendSystemCallInternal(int fd, bool locked, int parentProc, | 188 static void sendSystemCallInternal(int fd, bool locked, int parentProc, |
| 179 Args* mem, int syscallNum, void* arg1 = 0, | 189 Args* mem, int syscallNum, void* arg1 = 0, |
| 180 void* arg2 = 0, void* arg3 = 0, | 190 void* arg2 = 0, void* arg3 = 0, |
| 181 void* arg4 = 0, void* arg5 = 0, | 191 void* arg4 = 0, void* arg5 = 0, |
| 182 void* arg6 = 0); | 192 void* arg6 = 0); |
| 183 }; | 193 }; |
| 184 | 194 |
| 185 } // namespace | 195 } // namespace |
| 186 | 196 |
| 187 #endif // SECURE_MEM_H__ | 197 #endif // SECURE_MEM_H__ |
| OLD | NEW |