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

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

Issue 1409633002: Non-SFI mode: Remove old Non-SFI code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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
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 504560ebc1927863f8e5120bb4c789fdf30f25b4..5a0249fad5cba8fc03f6f79ad349be2d6ce233c4 100644
--- a/components/nacl/loader/nonsfi/nonsfi_sandbox.cc
+++ b/components/nacl/loader/nonsfi/nonsfi_sandbox.cc
@@ -25,6 +25,10 @@
#include "sandbox/linux/system_headers/linux_signal.h"
#include "sandbox/linux/system_headers/linux_syscalls.h"
+#if !defined(OS_NACL_NONSFI)
+#error "nonsfi_sandbox.cc must be built for nacl_helper_nonsfi."
+#endif
+
// Chrome OS Daisy (ARM) build environment and PNaCl toolchain do not define
// MAP_STACK.
#if !defined(MAP_STACK)
@@ -78,14 +82,11 @@ ResultExpr RestrictFcntlCommands() {
ResultExpr RestrictClone() {
// We allow clone only for new thread creation.
- int clone_flags =
+ const int kCloneFlags =
CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND |
CLONE_THREAD | CLONE_SYSVSEM | CLONE_SETTLS | CLONE_PARENT_SETTID;
-#if !defined(OS_NACL_NONSFI)
- clone_flags |= CLONE_CHILD_CLEARTID;
-#endif
const Arg<int> flags(0);
- return If(flags == clone_flags, Allow()).Else(CrashSIGSYSClone());
+ return If(flags == kCloneFlags, Allow()).Else(CrashSIGSYSClone());
}
ResultExpr RestrictFutexOperation() {
@@ -116,13 +117,6 @@ ResultExpr RestrictSocketcall() {
// We only allow socketpair, sendmsg, and recvmsg.
const Arg<int> call(0);
return If(
-#if !defined(OS_NACL_NONSFI)
- // nacl_helper in Non-SFI mode still uses socketpair() internally
- // via libevent.
- // TODO(hidehiko): Remove this when the switching to nacl_helper_nonsfi
- // is completed.
- call == SYS_SOCKETPAIR ||
-#endif
call == SYS_SHUTDOWN || call == SYS_SENDMSG || call == SYS_RECVMSG,
Allow()).Else(CrashSIGSYS());
}
@@ -160,15 +154,6 @@ ResultExpr RestrictTgkill(int policy_pid) {
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.
- static_assert(AF_UNIX == PF_UNIX, "AF_UNIX must equal PF_UNIX.");
- const Arg<int> domain(0);
- return If(domain == AF_UNIX, Allow()).Else(CrashSIGSYS());
-}
-#endif
-
bool IsGracefullyDenied(int sysno) {
switch (sysno) {
// libevent tries this first and then falls back to poll if
@@ -318,14 +303,6 @@ ResultExpr NaClNonSfiBPFSandboxPolicy::EvaluateSyscall(int sysno) const {
case __NR_sendmsg:
case __NR_shutdown:
return Allow();
-#if !defined(OS_NACL_NONSFI)
- // nacl_helper in Non-SFI mode still uses socketpair() internally
- // via libevent.
- // TODO(hidehiko): Remove this when the switching to nacl_helper_nonsfi
- // is completed.
- case __NR_socketpair:
- return RestrictSocketpair();
-#endif
#endif
case __NR_tgkill:
« no previous file with comments | « components/nacl/loader/nonsfi/nonsfi_main.cc ('k') | components/nacl/loader/nonsfi/nonsfi_sandbox_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698