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

Unified Diff: sandbox/linux/seccomp-bpf/trap.h

Issue 937303005: Revert of bpf_dsl: decouple PolicyCompiler from Syscall (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 | « sandbox/linux/seccomp-bpf/sandbox_bpf.cc ('k') | sandbox/linux/seccomp-bpf/trap.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sandbox/linux/seccomp-bpf/trap.h
diff --git a/sandbox/linux/seccomp-bpf/trap.h b/sandbox/linux/seccomp-bpf/trap.h
index 63fff88b1d51deafe938acf4a38aee18946ab1e6..fea0052ffcd3e35226f5420abc1f6e97ee07db37 100644
--- a/sandbox/linux/seccomp-bpf/trap.h
+++ b/sandbox/linux/seccomp-bpf/trap.h
@@ -34,9 +34,23 @@
// creating it if necessary.
static bpf_dsl::TrapRegistry* Registry();
- // SandboxDebuggingAllowedByUser returns whether the
- // "CHROME_SANDBOX_DEBUGGING" environment variable is set.
- static bool SandboxDebuggingAllowedByUser();
+ // Registers a new trap handler and sets up the appropriate SIGSYS handler
+ // as needed.
+ // N.B.: This makes a permanent state change. Traps cannot be unregistered,
+ // as that would break existing BPF filters that are still active.
+ // TODO(mdempsky): Deprecated; remove.
+ static uint16_t MakeTrap(TrapFnc fnc, const void* aux, bool safe);
+
+ // Enables support for unsafe traps in the SIGSYS signal handler. This is a
+ // one-way fuse. It works in conjunction with the BPF compiler emitting code
+ // that unconditionally allows system calls, if they have a magic return
+ // address (i.e. SandboxSyscall(-1)).
+ // Once unsafe traps are enabled, the sandbox is essentially compromised.
+ // But this is still a very useful feature for debugging purposes. Use with
+ // care. This feature is availably only if enabled by the user (see above).
+ // Returns "true", if unsafe traps were turned on.
+ // TODO(mdempsky): Deprecated; remove.
+ static bool EnableUnsafeTrapsInSigSysHandler();
private:
struct TrapKey {
@@ -63,6 +77,8 @@
// dumps.
void SigSys(int nr, siginfo_t* info, void* void_context)
__attribute__((noinline));
+ bool SandboxDebuggingAllowedByUser() const;
+
// We have a global singleton that handles all of our SIGSYS traps. This
// variable must never be deallocated after it has been set up initially, as
// there is no way to reset in-kernel BPF filters that generate SIGSYS
« no previous file with comments | « sandbox/linux/seccomp-bpf/sandbox_bpf.cc ('k') | sandbox/linux/seccomp-bpf/trap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698