| 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 "sandbox_impl.h" | 5 #include "sandbox_impl.h" |
| 6 #include "syscall_table.h" | 6 #include "syscall_table.h" |
| 7 | 7 |
| 8 namespace playground { | 8 namespace playground { |
| 9 | 9 |
| 10 void Sandbox::createTrustedThread(int processFdPub, int cloneFdPub, | 10 void Sandbox::createTrustedThread(int processFdPub, int cloneFdPub, |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 // 0x04: first argument; passed in %rdi | 79 // 0x04: first argument; passed in %rdi |
| 80 // 0x0C: second argument; passed in %rsi | 80 // 0x0C: second argument; passed in %rsi |
| 81 // 0x14: third argument; passed in %rdx | 81 // 0x14: third argument; passed in %rdx |
| 82 // 0x1C: fourth argument; passed in %r10 | 82 // 0x1C: fourth argument; passed in %r10 |
| 83 // 0x24: fifth argument; passed in %r8 | 83 // 0x24: fifth argument; passed in %r8 |
| 84 // 0x2C: sixth argument; passed in %r9 | 84 // 0x2C: sixth argument; passed in %r9 |
| 85 // 0x34: return value | 85 // 0x34: return value |
| 86 // 0x3C: RDTSCP result (%eax) | 86 // 0x3C: RDTSCP result (%eax) |
| 87 // 0x40: RDTSCP result (%edx) | 87 // 0x40: RDTSCP result (%edx) |
| 88 // 0x44: RDTSCP result (%ecx) | 88 // 0x44: RDTSCP result (%ecx) |
| 89 // 0x48: last system call (not used on x86-64) |
| 90 // 0x4C: number of consecutive calls to a time fnc (not used on x86-64) |
| 91 // 0x50: nesting level of system calls (for debugging purposes only) |
| 89 | 92 |
| 90 // We use the %fs register for accessing the secure read-only page, and | 93 // We use the %fs register for accessing the secure read-only page, and |
| 91 // the untrusted scratch space immediately following it. The segment | 94 // the untrusted scratch space immediately following it. The segment |
| 92 // register and the local descriptor table is set up by passing | 95 // register and the local descriptor table is set up by passing |
| 93 // appropriate arguments to clone(). | 96 // appropriate arguments to clone(). |
| 94 | 97 |
| 95 "0:xor %%rsp, %%rsp\n" | 98 "0:xor %%rsp, %%rsp\n" |
| 96 "mov $2, %%ebx\n" // %rbx = initial sequence number | 99 "mov $2, %%ebx\n" // %rbx = initial sequence number |
| 97 | 100 |
| 98 // Read request from untrusted thread, or from trusted process. In either | 101 // Read request from untrusted thread, or from trusted process. In either |
| (...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 692 // 0x0C: third argument; passed in %edx | 695 // 0x0C: third argument; passed in %edx |
| 693 // 0x10: fourth argument; passed in %esi | 696 // 0x10: fourth argument; passed in %esi |
| 694 // 0x14: fifth argument; passed in %edi | 697 // 0x14: fifth argument; passed in %edi |
| 695 // 0x18: sixth argument; passed in %ebp | 698 // 0x18: sixth argument; passed in %ebp |
| 696 // 0x1C: return value | 699 // 0x1C: return value |
| 697 // 0x20: RDTSCP result (%eax) | 700 // 0x20: RDTSCP result (%eax) |
| 698 // 0x24: RDTSCP result (%edx) | 701 // 0x24: RDTSCP result (%edx) |
| 699 // 0x28: RDTSCP result (%ecx) | 702 // 0x28: RDTSCP result (%ecx) |
| 700 // 0x2C: last system call (updated in syscall.cc) | 703 // 0x2C: last system call (updated in syscall.cc) |
| 701 // 0x30: number of consecutive calls to a time fnc. (e.g. gettimeofday) | 704 // 0x30: number of consecutive calls to a time fnc. (e.g. gettimeofday) |
| 705 // 0x34: nesting level of system calls (for debugging purposes only) |
| 702 | 706 |
| 703 "0:xor %%esp, %%esp\n" | 707 "0:xor %%esp, %%esp\n" |
| 704 "mov $2, %%eax\n" // %mm2 = initial sequence number | 708 "mov $2, %%eax\n" // %mm2 = initial sequence number |
| 705 "movd %%eax, %%mm2\n" | 709 "movd %%eax, %%mm2\n" |
| 706 | 710 |
| 707 // Read request from untrusted thread, or from trusted process. In either | 711 // Read request from untrusted thread, or from trusted process. In either |
| 708 // case, the data that we read has to be considered untrusted. | 712 // case, the data that we read has to be considered untrusted. |
| 709 // read(threadFd, &scratch, 4) | 713 // read(threadFd, &scratch, 4) |
| 710 "1:mov $3, %%eax\n" // NR_read | 714 "1:mov $3, %%eax\n" // NR_read |
| 711 "movd %%mm0, %%ebx\n" // fd = threadFd | 715 "movd %%mm0, %%ebx\n" // fd = threadFd |
| (...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1244 : | 1248 : |
| 1245 : "g"(&args) | 1249 : "g"(&args) |
| 1246 : "eax", "ecx", "edx", "edi", "esi", "esp", "memory" | 1250 : "eax", "ecx", "edx", "edi", "esi", "esp", "memory" |
| 1247 #else | 1251 #else |
| 1248 #error Unsupported target platform | 1252 #error Unsupported target platform |
| 1249 #endif | 1253 #endif |
| 1250 ); | 1254 ); |
| 1251 } | 1255 } |
| 1252 | 1256 |
| 1253 } // namespace | 1257 } // namespace |
| OLD | NEW |