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 SANDBOX_IMPL_H__ | 5 #ifndef SANDBOX_IMPL_H__ |
6 #define SANDBOX_IMPL_H__ | 6 #define SANDBOX_IMPL_H__ |
7 | 7 |
8 #include <asm/ldt.h> | 8 #include <asm/ldt.h> |
9 #include <errno.h> | 9 #include <errno.h> |
10 #include <fcntl.h> | 10 #include <fcntl.h> |
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
591 // Thread local data available from each sandboxed thread. | 591 // Thread local data available from each sandboxed thread. |
592 enum { TLS_COOKIE, TLS_TID, TLS_THREAD_FD }; | 592 enum { TLS_COOKIE, TLS_TID, TLS_THREAD_FD }; |
593 static long long cookie() { return TLS::getTLSValue<long long>(TLS_COOKIE); } | 593 static long long cookie() { return TLS::getTLSValue<long long>(TLS_COOKIE); } |
594 static int tid() { return TLS::getTLSValue<int>(TLS_TID); } | 594 static int tid() { return TLS::getTLSValue<int>(TLS_TID); } |
595 static int threadFdPub() { return TLS::getTLSValue<int>(TLS_THREAD_FD); } | 595 static int threadFdPub() { return TLS::getTLSValue<int>(TLS_THREAD_FD); } |
596 static int processFdPub() { return processFdPub_; } | 596 static int processFdPub() { return processFdPub_; } |
597 static kernel_sigset_t* signalMask() { return &getSecureMem()->signalMask; } | 597 static kernel_sigset_t* signalMask() { return &getSecureMem()->signalMask; } |
598 | 598 |
599 // The SEGV handler knows how to handle RDTSC instructions | 599 // The SEGV handler knows how to handle RDTSC instructions |
600 static void setupSignalHandlers(); | 600 static void setupSignalHandlers(); |
601 static void (*segv())(int signo); | 601 static void (*segv())(int signo, SysCalls::siginfo *context, void *unused); |
602 | 602 |
603 // If no specific handler has been registered for a system call, call this | 603 // If no specific handler has been registered for a system call, call this |
604 // function which asks the trusted thread to perform the call. This is used | 604 // function which asks the trusted thread to perform the call. This is used |
605 // for system calls that are not restricted. | 605 // for system calls that are not restricted. |
606 static void* defaultSystemCallHandler(int syscallNum, void* arg0, | 606 static void* defaultSystemCallHandler(int syscallNum, void* arg0, |
607 void* arg1, void* arg2, void* arg3, | 607 void* arg1, void* arg2, void* arg3, |
608 void* arg4, void* arg5) | 608 void* arg4, void* arg5) |
609 asm("playground$defaultSystemCallHandler") | 609 asm("playground$defaultSystemCallHandler") |
610 #if defined(__x86_64__) | 610 #if defined(__x86_64__) |
611 __attribute__((visibility("internal"))) | 611 __attribute__((visibility("internal"))) |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
670 static ProtectedMap protectedMap_; | 670 static ProtectedMap protectedMap_; |
671 static std::vector<SecureMem::Args*> secureMemPool_; | 671 static std::vector<SecureMem::Args*> secureMemPool_; |
672 }; | 672 }; |
673 | 673 |
674 } // namespace | 674 } // namespace |
675 | 675 |
676 using playground::Sandbox; | 676 using playground::Sandbox; |
677 #endif // __cplusplus | 677 #endif // __cplusplus |
678 | 678 |
679 #endif // SANDBOX_IMPL_H__ | 679 #endif // SANDBOX_IMPL_H__ |
OLD | NEW |