1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "content/common/sandbox_linux/android/sandbox_bpf_base_policy_android.h"
7 #include <sys/syscall.h>
10 #include "sandbox/linux/bpf_dsl/bpf_dsl.h"
12 using sandbox::bpf_dsl::Allow
;
13 using sandbox::bpf_dsl::ResultExpr
;
17 SandboxBPFBasePolicyAndroid::SandboxBPFBasePolicyAndroid()
18 : SandboxBPFBasePolicy() {}
20 SandboxBPFBasePolicyAndroid::~SandboxBPFBasePolicyAndroid() {}
22 ResultExpr
SandboxBPFBasePolicyAndroid::EvaluateSyscall(int sysno
) const {
23 bool override_and_allow
= false;
26 // TODO(rsesek): restrict clone parameters.
28 case __NR_epoll_pwait
:
30 #if defined(__x86_64__) || defined(__aarch64__)
32 #elif defined(__i386__) || defined(__arm__) || defined(__mips__)
35 case __NR_getpriority
:
38 // File system access cannot be restricted with seccomp-bpf on Android,
39 // since the JVM classloader and other Framework features require file
40 // access. It may be possible to restrict the filesystem with SELinux.
41 // Currently we rely on the app/service UID isolation to create a
42 // filesystem "sandbox".
43 #if !defined(ARCH_CPU_ARM64)
48 case __NR_rt_sigtimedwait
:
49 case __NR_setpriority
:
50 case __NR_set_tid_address
:
51 case __NR_sigaltstack
:
52 #if defined(__i386__) || defined(__arm__)
58 override_and_allow
= true;
62 if (override_and_allow
)
65 return SandboxBPFBasePolicy::EvaluateSyscall(sysno
);
68 } // namespace content