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

Unified Diff: sandbox/linux/seccomp-bpf/sandbox_bpf.cc

Issue 572753002: Decouple Trap from ErrorCode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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: sandbox/linux/seccomp-bpf/sandbox_bpf.cc
diff --git a/sandbox/linux/seccomp-bpf/sandbox_bpf.cc b/sandbox/linux/seccomp-bpf/sandbox_bpf.cc
index 12667e73e6cf3c4f37fc51b98272809bb73f314c..23aebf20c341a7b35db7f455aa1e65fb69c67fe0 100644
--- a/sandbox/linux/seccomp-bpf/sandbox_bpf.cc
+++ b/sandbox/linux/seccomp-bpf/sandbox_bpf.cc
@@ -144,9 +144,7 @@ void CheckForUnsafeErrorCodes(Instruction* insn, void* aux) {
if (!*is_unsafe) {
if (BPF_CLASS(insn->code) == BPF_RET && insn->k > SECCOMP_RET_TRAP &&
insn->k - SECCOMP_RET_TRAP <= SECCOMP_RET_DATA) {
- const ErrorCode& err =
- Trap::ErrorCodeFromTrapId(insn->k & SECCOMP_RET_DATA);
- if (err.error_type() != ErrorCode::ET_INVALID && !err.safe()) {
+ if (!Trap::IsSafeTrapId(insn->k & SECCOMP_RET_DATA)) {
*is_unsafe = true;
}
}
@@ -1020,11 +1018,11 @@ ErrorCode SandboxBPF::Unexpected64bitArgument() {
}
ErrorCode SandboxBPF::Trap(Trap::TrapFnc fnc, const void* aux) {
- return Trap::MakeTrap(fnc, aux, true /* Safe Trap */);
+ return ErrorCode(fnc, aux, true /* Safe Trap */);
}
ErrorCode SandboxBPF::UnsafeTrap(Trap::TrapFnc fnc, const void* aux) {
- return Trap::MakeTrap(fnc, aux, false /* Unsafe Trap */);
+ return ErrorCode(fnc, aux, false /* Unsafe Trap */);
}
bool SandboxBPF::IsRequiredForUnsafeTrap(int sysno) {

Powered by Google App Engine
This is Rietveld 408576698