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

Side by Side Diff: sandbox/linux/seccomp-bpf/codegen.cc

Issue 278583005: Linux Sandbox: Add support for SECCOMP_RET_TRACE. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix LOG(FATAL) behavior on Android. Created 6 years, 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | sandbox/linux/seccomp-bpf/errorcode.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | sandbox/linux/seccomp-bpf/errorcode.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698