Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(310)

Unified Diff: components/nacl/loader/nonsfi/nonsfi_sandbox.cc

Issue 1295513003: Non-SFI mode: Sandbox support for NaCl async-signals. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/nacl/loader/nonsfi/nonsfi_sandbox.cc
diff --git a/components/nacl/loader/nonsfi/nonsfi_sandbox.cc b/components/nacl/loader/nonsfi/nonsfi_sandbox.cc
index 475c28c28c637f4975287402af9c28b65132117c..9587010e02298f49e2afa127ee84eb410b6d4284 100644
--- a/components/nacl/loader/nonsfi/nonsfi_sandbox.cc
+++ b/components/nacl/loader/nonsfi/nonsfi_sandbox.cc
@@ -22,6 +22,7 @@
#include "sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.h"
#include "sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h"
#include "sandbox/linux/system_headers/linux_futex.h"
+#include "sandbox/linux/system_headers/linux_signal.h"
#include "sandbox/linux/system_headers/linux_syscalls.h"
// Chrome OS Daisy (ARM) build environment and PNaCl toolchain do not define
@@ -83,7 +84,9 @@ ResultExpr RestrictClone() {
clone_flags |= CLONE_PARENT_SETTID | CLONE_CHILD_CLEARTID;
#endif
const Arg<int> flags(0);
- return If(flags == clone_flags, Allow()).Else(CrashSIGSYSClone());
+ return If(flags == clone_flags ||
Mark Seaborn 2015/08/13 23:38:10 How about adding a TODO to remove the variant with
Luis Héctor Chávez 2015/08/14 00:29:32 Done.
+ flags == (clone_flags | CLONE_PARENT_SETTID),
+ Allow()).Else(CrashSIGSYSClone());
}
ResultExpr RestrictFutexOperation() {
@@ -146,6 +149,13 @@ ResultExpr RestrictMmap() {
Allow()).Else(CrashSIGSYS());
}
+ResultExpr RestrictTgkill() {
+ const Arg<int> tgid(0), signum(2);
+ // Only sending SIGUSR1 to a thread in the same process is allowed.
+ return If(tgid == getpid() && signum == LINUX_SIGUSR1,
Mark Seaborn 2015/08/13 23:38:10 Should we check that the thread ID is positive too
Luis Héctor Chávez 2015/08/14 00:29:32 Arg<int> does not support greater-than comparison
Mark Seaborn 2015/08/14 20:12:41 I suppose you can check that: * arg != 0 * (arg
+ Allow()).Else(CrashSIGSYS());
+}
+
#if !defined(OS_NACL_NONSFI) && (defined(__x86_64__) || defined(__arm__))
ResultExpr RestrictSocketpair() {
// Only allow AF_UNIX, PF_UNIX. Crash if anything else is seen.
@@ -304,6 +314,9 @@ ResultExpr NaClNonSfiBPFSandboxPolicy::EvaluateSyscall(int sysno) const {
#endif
#endif
+ case __NR_tgkill:
+ return RestrictTgkill();
+
case __NR_brk:
// The behavior of brk on Linux is different from other system
// calls. It does not return errno but the current break on
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698