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

Unified Diff: sandbox/linux/seccomp-bpf/sandbox_bpf_unittest.cc

Issue 10827223: Add basic ARM support to the seccomp-bpf sandbox. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Make unit tests pass on ARM. Created 8 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: sandbox/linux/seccomp-bpf/sandbox_bpf_unittest.cc
diff --git a/sandbox/linux/seccomp-bpf/sandbox_bpf_unittest.cc b/sandbox/linux/seccomp-bpf/sandbox_bpf_unittest.cc
index b8ae3b72407fc94883b22cf06043d23f16415bd9..699855f9ab361e91b178b5f677f8fe48f68c8034 100644
--- a/sandbox/linux/seccomp-bpf/sandbox_bpf_unittest.cc
+++ b/sandbox/linux/seccomp-bpf/sandbox_bpf_unittest.cc
@@ -13,6 +13,9 @@ using namespace playground2;
namespace {
const int kExpectedReturnValue = 42;
+#if defined(__arm__)
+const int kArmPublicSysnoCeiling = __NR_SYSCALL_BASE + 1024;
+#endif
TEST(SandboxBpf, CallSupports) {
// We check that we don't crash, but it's ok if the kernel doesn't
@@ -234,6 +237,13 @@ Sandbox::ErrorCode SyntheticPolicy(int sysno) {
// FIXME: we should really not have to do that in a trivial policy.
return ENOSYS;
}
+
+ // TODO(jorgelo): remove this restriction once crbug.com/141694 is fixed.
+#if defined(__arm__)
+ if (sysno > kArmPublicSysnoCeiling)
+ return ENOSYS;
+#endif
+
if (sysno == __NR_exit_group) {
// exit_group() is special, we really need it to work.
return Sandbox::SB_ALLOWED;
@@ -249,8 +259,16 @@ void SyntheticProcess(void) {
static_cast<int>(MAX_SYSCALL)) {
ExitGroup(1);
}
+
+ // TODO(jorgelo): remove this limit once crbug.com/141694 is fixed.
+#if defined(__arm__)
+ int sysno_ceiling = kArmPublicSysnoCeiling;
jln (very slow on Chromium) 2012/08/09 22:41:23 These should be const.
Jorge Lucangeli Obes 2012/08/09 22:58:26 Done.
+#else
+ int sysno_ceiling = static_cast<int>(MAX_SYSCALL);
+#endif
+
for (int syscall_number = static_cast<int>(MIN_SYSCALL);
- syscall_number <= static_cast<int>(MAX_SYSCALL);
+ syscall_number <= sysno_ceiling;
++syscall_number) {
if (syscall_number == __NR_exit_group) {
// exit_group() is special
« sandbox/linux/seccomp-bpf/sandbox_bpf.h ('K') | « sandbox/linux/seccomp-bpf/sandbox_bpf.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698