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

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

Issue 10908270: Fix sandbox_bpf_unittest compile on ARM (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | 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 <ostream> 5 #include <ostream>
6 6
7 #include "sandbox/linux/seccomp-bpf/bpf_tests.h" 7 #include "sandbox/linux/seccomp-bpf/bpf_tests.h"
8 #include "sandbox/linux/seccomp-bpf/verifier.h" 8 #include "sandbox/linux/seccomp-bpf/verifier.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 ErrorCode SyntheticPolicy(int sysno) { 150 ErrorCode SyntheticPolicy(int sysno) {
151 if (sysno < static_cast<int>(MIN_SYSCALL) || 151 if (sysno < static_cast<int>(MIN_SYSCALL) ||
152 sysno > static_cast<int>(MAX_SYSCALL)) { 152 sysno > static_cast<int>(MAX_SYSCALL)) {
153 // FIXME: we should really not have to do that in a trivial policy. 153 // FIXME: we should really not have to do that in a trivial policy.
154 return ErrorCode(ENOSYS); 154 return ErrorCode(ENOSYS);
155 } 155 }
156 156
157 // TODO(jorgelo): remove this restriction once crbug.com/141694 is fixed. 157 // TODO(jorgelo): remove this restriction once crbug.com/141694 is fixed.
158 #if defined(__arm__) 158 #if defined(__arm__)
159 if (sysno > kArmPublicSysnoCeiling) 159 if (sysno > kArmPublicSysnoCeiling)
160 return ENOSYS; 160 return ErrorCode(ENOSYS);
161 #endif 161 #endif
162 162
163 // TODO(markus): allow calls to write(). This should start working as soon 163 // TODO(markus): allow calls to write(). This should start working as soon
164 // as we switch to the new code generator. Currently we are blowing up, 164 // as we switch to the new code generator. Currently we are blowing up,
165 // because our jumptable is getting too big. 165 // because our jumptable is getting too big.
166 if (sysno == __NR_exit_group /* || sysno == __NR_write */) { 166 if (sysno == __NR_exit_group /* || sysno == __NR_write */) {
167 // exit_group() is special, we really need it to work. 167 // exit_group() is special, we really need it to work.
168 // write() is needed for BPF_ASSERT() to report a useful error message. 168 // write() is needed for BPF_ASSERT() to report a useful error message.
169 return ErrorCode(ErrorCode::ERR_ALLOWED); 169 return ErrorCode(ErrorCode::ERR_ALLOWED);
170 } else { 170 } else {
(...skipping 23 matching lines...) Expand all
194 // exit_group() is special 194 // exit_group() is special
195 continue; 195 continue;
196 } 196 }
197 errno = 0; 197 errno = 0;
198 BPF_ASSERT(syscall(syscall_number) == -1); 198 BPF_ASSERT(syscall(syscall_number) == -1);
199 BPF_ASSERT(errno == SysnoToRandomErrno(syscall_number)); 199 BPF_ASSERT(errno == SysnoToRandomErrno(syscall_number));
200 } 200 }
201 } 201 }
202 202
203 } // namespace 203 } // namespace
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698