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 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 Ld(&state, insn, err); | 416 Ld(&state, insn, err); |
417 break; | 417 break; |
418 case BPF_JMP: | 418 case BPF_JMP: |
419 Jmp(&state, insn, err); | 419 Jmp(&state, insn, err); |
420 break; | 420 break; |
421 case BPF_RET: { | 421 case BPF_RET: { |
422 uint32_t r = Ret(&state, insn, err); | 422 uint32_t r = Ret(&state, insn, err); |
423 switch (r & SECCOMP_RET_ACTION) { | 423 switch (r & SECCOMP_RET_ACTION) { |
424 case SECCOMP_RET_TRAP: | 424 case SECCOMP_RET_TRAP: |
425 case SECCOMP_RET_ERRNO: | 425 case SECCOMP_RET_ERRNO: |
| 426 case SECCOMP_RET_TRACE: |
426 case SECCOMP_RET_ALLOW: | 427 case SECCOMP_RET_ALLOW: |
427 break; | 428 break; |
428 case SECCOMP_RET_KILL: // We don't ever generate this | 429 case SECCOMP_RET_KILL: // We don't ever generate this |
429 case SECCOMP_RET_TRACE: // We don't ever generate this | |
430 case SECCOMP_RET_INVALID: // Should never show up in BPF program | 430 case SECCOMP_RET_INVALID: // Should never show up in BPF program |
431 default: | 431 default: |
432 *err = "Unexpected return code found in BPF program"; | 432 *err = "Unexpected return code found in BPF program"; |
433 return 0; | 433 return 0; |
434 } | 434 } |
435 return r; | 435 return r; |
436 } | 436 } |
437 case BPF_ALU: | 437 case BPF_ALU: |
438 Alu(&state, insn, err); | 438 Alu(&state, insn, err); |
439 break; | 439 break; |
440 default: | 440 default: |
441 *err = "Unexpected instruction in BPF program"; | 441 *err = "Unexpected instruction in BPF program"; |
442 break; | 442 break; |
443 } | 443 } |
444 } | 444 } |
445 return 0; | 445 return 0; |
446 } | 446 } |
447 | 447 |
448 } // namespace sandbox | 448 } // namespace sandbox |
OLD | NEW |