summaryrefslogtreecommitdiffstats
path: root/sandbox/linux/seccomp/sigprocmask.cc
diff options
context:
space:
mode:
authormseaborn@chromium.org <mseaborn@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-01 16:22:01 +0000
committermseaborn@chromium.org <mseaborn@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-01 16:22:01 +0000
commit808ea578e1597271a1a73de640e9957babb4f9ea (patch)
tree119f7e82f154f61f1cfee5504063223dd41a211d /sandbox/linux/seccomp/sigprocmask.cc
parent4253e8240d8c71588abebcc123d4e224c8a6a83a (diff)
downloadchromium_src-808ea578e1597271a1a73de640e9957babb4f9ea.zip
chromium_src-808ea578e1597271a1a73de640e9957babb4f9ea.tar.gz
chromium_src-808ea578e1597271a1a73de640e9957babb4f9ea.tar.bz2
Pull seccomp-sandbox in via DEPS rather than using an in-tree copy
This means changes to the sandbox won't have to be committed twice, to both trees. This is a retry of r57921, which was committed with git-svn and failed to remove the "seccomp" directory. This caused problems when trying to "svn checkout" to the same location, and the change was reverted. This time I will use SVN to commit the change. BUG=none TEST=smoke test of running chromium with --enable-seccomp-sandbox Review URL: http://codereview.chromium.org/3225010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58184 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sandbox/linux/seccomp/sigprocmask.cc')
-rw-r--r--sandbox/linux/seccomp/sigprocmask.cc120
1 files changed, 0 insertions, 120 deletions
diff --git a/sandbox/linux/seccomp/sigprocmask.cc b/sandbox/linux/seccomp/sigprocmask.cc
deleted file mode 100644
index 9ff2922..0000000
--- a/sandbox/linux/seccomp/sigprocmask.cc
+++ /dev/null
@@ -1,120 +0,0 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "debug.h"
-#include "sandbox_impl.h"
-
-namespace playground {
-
-// If the sandboxed process tries to mask SIGSEGV, there is a good chance
-// the process will eventually get terminated. If this is really ever a
-// problem, we can hide the fact that SIGSEGV is unmasked. But I don't think
-// we really need this. Masking of synchronous signals is rarely necessary.
-
-#if defined(__NR_sigprocmask)
-long Sandbox::sandbox_sigprocmask(int how, const void* set, void* old_set) {
- long long tm;
- Debug::syscall(&tm, __NR_sigprocmask, "Executing handler");
-
- // Access the signal mask by triggering a SEGV and modifying the signal state
- // prior to calling rt_sigreturn().
- long res = -ENOSYS;
- #if defined(__x86_64__)
- #error x86-64 does not support sigprocmask(); use rt_sigprocmask() instead
- #elif defined(__i386__)
- asm volatile(
- "push %%ebx\n"
- "movl %2, %%ebx\n"
- "int $0\n"
- "pop %%ebx\n"
- : "=a"(res)
- : "0"(__NR_sigprocmask), "ri"((long)how),
- "c"((long)set), "d"((long)old_set)
- : "esp", "memory");
- #else
- #error Unsupported target platform
- #endif
-
- // Update our shadow signal mask, so that we can copy it upon creation of
- // new threads.
- if (res == 0 && set != NULL) {
- SecureMem::Args* args = getSecureMem();
- switch (how) {
- case SIG_BLOCK:
- *(unsigned long long *)&args->signalMask |= *(unsigned long long *)set;
- break;
- case SIG_UNBLOCK:
- *(unsigned long long *)&args->signalMask &= ~*(unsigned long long *)set;
- break;
- case SIG_SETMASK:
- *(unsigned long long *)&args->signalMask = *(unsigned long long *)set;
- break;
- default:
- break;
- }
- }
-
- Debug::elapsed(tm, __NR_sigprocmask);
-
- return res;
-}
-#endif
-
-#if defined(__NR_rt_sigprocmask)
-long Sandbox::sandbox_rt_sigprocmask(int how, const void* set, void* old_set,
- size_t bytes) {
- long long tm;
- Debug::syscall(&tm, __NR_rt_sigprocmask, "Executing handler");
-
- // Access the signal mask by triggering a SEGV and modifying the signal state
- // prior to calling rt_sigreturn().
- long res = -ENOSYS;
- #if defined(__x86_64__)
- asm volatile(
- "movq %5, %%r10\n"
- "int $0\n"
- : "=a"(res)
- : "0"(__NR_rt_sigprocmask), "D"((long)how),
- "S"((long)set), "d"((long)old_set), "r"((long)bytes)
- : "r10", "r11", "rcx", "memory");
- #elif defined(__i386__)
- asm volatile(
- "push %%ebx\n"
- "movl %2, %%ebx\n"
- "int $0\n"
- "pop %%ebx\n"
- : "=a"(res)
- : "0"(__NR_rt_sigprocmask), "ri"((long)how),
- "c"((long)set), "d"((long)old_set), "S"((long)bytes)
- : "esp", "memory");
- #else
- #error Unsupported target platform
- #endif
-
- // Update our shadow signal mask, so that we can copy it upon creation of
- // new threads.
- if (res == 0 && set != NULL && bytes >= 8) {
- SecureMem::Args* args = getSecureMem();
- switch (how) {
- case SIG_BLOCK:
- *(unsigned long long *)&args->signalMask |= *(unsigned long long *)set;
- break;
- case SIG_UNBLOCK:
- *(unsigned long long *)&args->signalMask &= ~*(unsigned long long *)set;
- break;
- case SIG_SETMASK:
- *(unsigned long long *)&args->signalMask = *(unsigned long long *)set;
- break;
- default:
- break;
- }
- }
-
- Debug::elapsed(tm, __NR_rt_sigprocmask);
-
- return res;
-}
-#endif
-
-} // namespace