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

Unified Diff: sandbox/linux/bpf_dsl/bpf_dsl.cc

Issue 1310773006: Update sandbox/linux from upstream (Closed) Base URL: ssh://ssh.github.com/domokit/mojo.git@master
Patch Set: Update to 3909ebfa69566f7374a6900e63cd4d3c73a35378 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 | « sandbox/linux/bpf_dsl/bpf_dsl.h ('k') | sandbox/linux/bpf_dsl/bpf_dsl_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sandbox/linux/bpf_dsl/bpf_dsl.cc
diff --git a/sandbox/linux/bpf_dsl/bpf_dsl.cc b/sandbox/linux/bpf_dsl/bpf_dsl.cc
index 3a35903ec91a3a7f7690dce1471b81b41bffacef..276aaf6e04f28f4bf456eae709401e52544c5807 100644
--- a/sandbox/linux/bpf_dsl/bpf_dsl.cc
+++ b/sandbox/linux/bpf_dsl/bpf_dsl.cc
@@ -9,18 +9,13 @@
#include "base/logging.h"
#include "base/memory/ref_counted.h"
#include "sandbox/linux/bpf_dsl/bpf_dsl_impl.h"
+#include "sandbox/linux/bpf_dsl/errorcode.h"
#include "sandbox/linux/bpf_dsl/policy_compiler.h"
-#include "sandbox/linux/seccomp-bpf/die.h"
-#include "sandbox/linux/seccomp-bpf/errorcode.h"
namespace sandbox {
namespace bpf_dsl {
namespace {
-intptr_t BPFFailure(const struct arch_seccomp_data&, void* aux) {
- SANDBOX_DIE(static_cast<char*>(aux));
-}
-
class AllowResultExprImpl : public internal::ResultExprImpl {
public:
AllowResultExprImpl() {}
@@ -57,6 +52,22 @@ class ErrorResultExprImpl : public internal::ResultExprImpl {
DISALLOW_COPY_AND_ASSIGN(ErrorResultExprImpl);
};
+class KillResultExprImpl : public internal::ResultExprImpl {
+ public:
+ KillResultExprImpl() {}
+
+ ErrorCode Compile(PolicyCompiler* pc) const override {
+ return ErrorCode(ErrorCode::ERR_KILL);
+ }
+
+ bool IsDeny() const override { return true; }
+
+ private:
+ ~KillResultExprImpl() override {}
+
+ DISALLOW_COPY_AND_ASSIGN(KillResultExprImpl);
+};
+
class TraceResultExprImpl : public internal::ResultExprImpl {
public:
TraceResultExprImpl(uint16_t aux) : aux_(aux) {}
@@ -255,6 +266,8 @@ uint64_t DefaultMask(size_t size) {
}
BoolExpr ArgEq(int num, size_t size, uint64_t mask, uint64_t val) {
+ // If this is changed, update Arg<T>::EqualTo's static_cast rules
+ // accordingly.
CHECK(size == 4 || size == 8);
// TODO(mdempsky): Should we just always use TP_64BIT?
@@ -274,8 +287,8 @@ ResultExpr Error(int err) {
return ResultExpr(new const ErrorResultExprImpl(err));
}
-ResultExpr Kill(const char* msg) {
- return Trap(BPFFailure, msg);
+ResultExpr Kill() {
+ return ResultExpr(new const KillResultExprImpl());
}
ResultExpr Trace(uint16_t aux) {
« no previous file with comments | « sandbox/linux/bpf_dsl/bpf_dsl.h ('k') | sandbox/linux/bpf_dsl/bpf_dsl_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698