| 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 <stdio.h> |    5 #include <stdio.h> | 
|    6  |    6  | 
|    7 #include "base/logging.h" |    7 #include "base/logging.h" | 
|    8 #include "sandbox/linux/seccomp-bpf/codegen.h" |    8 #include "sandbox/linux/seccomp-bpf/codegen.h" | 
|    9  |    9  | 
|   10 namespace { |   10 namespace { | 
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   99               (int)iter->k, |   99               (int)iter->k, | 
|  100               ip + iter->jt + 1, ip + iter->jf + 1); |  100               ip + iter->jt + 1, ip + iter->jf + 1); | 
|  101         } |  101         } | 
|  102         break; |  102         break; | 
|  103       case BPF_RET: |  103       case BPF_RET: | 
|  104         fprintf(stderr, "RET 0x%x  // ", iter->k); |  104         fprintf(stderr, "RET 0x%x  // ", iter->k); | 
|  105         if ((iter->k & SECCOMP_RET_ACTION) == SECCOMP_RET_TRAP) { |  105         if ((iter->k & SECCOMP_RET_ACTION) == SECCOMP_RET_TRAP) { | 
|  106           fprintf(stderr, "Trap #%d\n", iter->k & SECCOMP_RET_DATA); |  106           fprintf(stderr, "Trap #%d\n", iter->k & SECCOMP_RET_DATA); | 
|  107         } else if ((iter->k & SECCOMP_RET_ACTION) == SECCOMP_RET_ERRNO) { |  107         } else if ((iter->k & SECCOMP_RET_ACTION) == SECCOMP_RET_ERRNO) { | 
|  108           fprintf(stderr, "errno = %d\n", iter->k & SECCOMP_RET_DATA); |  108           fprintf(stderr, "errno = %d\n", iter->k & SECCOMP_RET_DATA); | 
 |  109         } else if ((iter->k & SECCOMP_RET_ACTION) == SECCOMP_RET_TRACE) { | 
 |  110           fprintf(stderr, "Trace #%d\n", iter->k & SECCOMP_RET_DATA); | 
|  109         } else if (iter->k == SECCOMP_RET_ALLOW) { |  111         } else if (iter->k == SECCOMP_RET_ALLOW) { | 
|  110           fprintf(stderr, "Allowed\n"); |  112           fprintf(stderr, "Allowed\n"); | 
|  111         } else { |  113         } else { | 
|  112           fprintf(stderr, "???\n"); |  114           fprintf(stderr, "???\n"); | 
|  113         } |  115         } | 
|  114         break; |  116         break; | 
|  115       case BPF_ALU: |  117       case BPF_ALU: | 
|  116         fprintf(stderr, BPF_OP(iter->code) == BPF_NEG |  118         fprintf(stderr, BPF_OP(iter->code) == BPF_NEG | 
|  117             ? "A := -A\n" : "A := A %s 0x%x\n", |  119             ? "A := -A\n" : "A := A %s 0x%x\n", | 
|  118             BPF_OP(iter->code) == BPF_ADD ? "+"  : |  120             BPF_OP(iter->code) == BPF_ADD ? "+"  : | 
| (...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  759       CutGraphIntoBasicBlocks(instructions, branch_targets, &all_blocks); |  761       CutGraphIntoBasicBlocks(instructions, branch_targets, &all_blocks); | 
|  760   MergeTails(&all_blocks); |  762   MergeTails(&all_blocks); | 
|  761   BasicBlocks basic_blocks; |  763   BasicBlocks basic_blocks; | 
|  762   TopoSortBasicBlocks(first_block, all_blocks, &basic_blocks); |  764   TopoSortBasicBlocks(first_block, all_blocks, &basic_blocks); | 
|  763   ComputeRelativeJumps(&basic_blocks, all_blocks); |  765   ComputeRelativeJumps(&basic_blocks, all_blocks); | 
|  764   ConcatenateBasicBlocks(basic_blocks, program); |  766   ConcatenateBasicBlocks(basic_blocks, program); | 
|  765   return; |  767   return; | 
|  766 } |  768 } | 
|  767  |  769  | 
|  768 }  // namespace sandbox |  770 }  // namespace sandbox | 
| OLD | NEW |