| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <string.h> | 5 #include <string.h> |
| 6 | 6 |
| 7 #include "sandbox/linux/seccomp-bpf/sandbox_bpf.h" | 7 #include "sandbox/linux/seccomp-bpf/sandbox_bpf.h" |
| 8 #include "sandbox/linux/seccomp-bpf/sandbox_bpf_policy.h" | 8 #include "sandbox/linux/seccomp-bpf/sandbox_bpf_policy.h" |
| 9 #include "sandbox/linux/seccomp-bpf/syscall_iterator.h" | 9 #include "sandbox/linux/seccomp-bpf/syscall_iterator.h" |
| 10 #include "sandbox/linux/seccomp-bpf/verifier.h" | 10 #include "sandbox/linux/seccomp-bpf/verifier.h" |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 Ld(&state, insn, err); | 414 Ld(&state, insn, err); |
| 415 break; | 415 break; |
| 416 case BPF_JMP: | 416 case BPF_JMP: |
| 417 Jmp(&state, insn, err); | 417 Jmp(&state, insn, err); |
| 418 break; | 418 break; |
| 419 case BPF_RET: { | 419 case BPF_RET: { |
| 420 uint32_t r = Ret(&state, insn, err); | 420 uint32_t r = Ret(&state, insn, err); |
| 421 switch (r & SECCOMP_RET_ACTION) { | 421 switch (r & SECCOMP_RET_ACTION) { |
| 422 case SECCOMP_RET_TRAP: | 422 case SECCOMP_RET_TRAP: |
| 423 case SECCOMP_RET_ERRNO: | 423 case SECCOMP_RET_ERRNO: |
| 424 case SECCOMP_RET_TRACE: |
| 424 case SECCOMP_RET_ALLOW: | 425 case SECCOMP_RET_ALLOW: |
| 425 break; | 426 break; |
| 426 case SECCOMP_RET_KILL: // We don't ever generate this | 427 case SECCOMP_RET_KILL: // We don't ever generate this |
| 427 case SECCOMP_RET_TRACE: // We don't ever generate this | |
| 428 case SECCOMP_RET_INVALID: // Should never show up in BPF program | 428 case SECCOMP_RET_INVALID: // Should never show up in BPF program |
| 429 default: | 429 default: |
| 430 *err = "Unexpected return code found in BPF program"; | 430 *err = "Unexpected return code found in BPF program"; |
| 431 return 0; | 431 return 0; |
| 432 } | 432 } |
| 433 return r; | 433 return r; |
| 434 } | 434 } |
| 435 case BPF_ALU: | 435 case BPF_ALU: |
| 436 Alu(&state, insn, err); | 436 Alu(&state, insn, err); |
| 437 break; | 437 break; |
| 438 default: | 438 default: |
| 439 *err = "Unexpected instruction in BPF program"; | 439 *err = "Unexpected instruction in BPF program"; |
| 440 break; | 440 break; |
| 441 } | 441 } |
| 442 } | 442 } |
| 443 return 0; | 443 return 0; |
| 444 } | 444 } |
| 445 | 445 |
| 446 } // namespace sandbox | 446 } // namespace sandbox |
| OLD | NEW |