OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "services/shell/runner/host/linux_sandbox.h" | 5 #include "services/shell/runner/host/linux_sandbox.h" |
6 | 6 |
7 #include <fcntl.h> | 7 #include <fcntl.h> |
8 #include <sys/syscall.h> | 8 #include <sys/syscall.h> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 20 matching lines...) Expand all Loading... |
31 namespace shell { | 31 namespace shell { |
32 | 32 |
33 namespace { | 33 namespace { |
34 | 34 |
35 intptr_t SandboxSIGSYSHandler(const struct sandbox::arch_seccomp_data& args, | 35 intptr_t SandboxSIGSYSHandler(const struct sandbox::arch_seccomp_data& args, |
36 void* aux) { | 36 void* aux) { |
37 RAW_CHECK(aux); | 37 RAW_CHECK(aux); |
38 const sandbox::syscall_broker::BrokerProcess* broker_process = | 38 const sandbox::syscall_broker::BrokerProcess* broker_process = |
39 static_cast<const sandbox::syscall_broker::BrokerProcess*>(aux); | 39 static_cast<const sandbox::syscall_broker::BrokerProcess*>(aux); |
40 switch (args.nr) { | 40 switch (args.nr) { |
| 41 #if !defined(__aarch64__) |
41 case __NR_access: | 42 case __NR_access: |
42 return broker_process->Access(reinterpret_cast<const char*>(args.args[0]), | 43 return broker_process->Access(reinterpret_cast<const char*>(args.args[0]), |
43 static_cast<int>(args.args[1])); | 44 static_cast<int>(args.args[1])); |
44 case __NR_open: | 45 case __NR_open: |
45 return broker_process->Open(reinterpret_cast<const char*>(args.args[0]), | 46 return broker_process->Open(reinterpret_cast<const char*>(args.args[0]), |
46 static_cast<int>(args.args[1])); | 47 static_cast<int>(args.args[1])); |
| 48 #endif |
47 case __NR_faccessat: | 49 case __NR_faccessat: |
48 if (static_cast<int>(args.args[0]) == AT_FDCWD) { | 50 if (static_cast<int>(args.args[0]) == AT_FDCWD) { |
49 return broker_process->Access( | 51 return broker_process->Access( |
50 reinterpret_cast<const char*>(args.args[1]), | 52 reinterpret_cast<const char*>(args.args[1]), |
51 static_cast<int>(args.args[2])); | 53 static_cast<int>(args.args[2])); |
52 } else { | 54 } else { |
53 return -EPERM; | 55 return -EPERM; |
54 } | 56 } |
55 case __NR_openat: | 57 case __NR_openat: |
56 // Allow using openat() as open(). | 58 // Allow using openat() as open(). |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 sandbox::syscall_broker::BrokerProcess* leaked_broker = broker_.release(); | 160 sandbox::syscall_broker::BrokerProcess* leaked_broker = broker_.release(); |
159 ALLOW_UNUSED_LOCAL(leaked_broker); | 161 ALLOW_UNUSED_LOCAL(leaked_broker); |
160 ANNOTATE_LEAKING_OBJECT_PTR(leaked_broker); | 162 ANNOTATE_LEAKING_OBJECT_PTR(leaked_broker); |
161 } | 163 } |
162 | 164 |
163 void LinuxSandbox::Seal() { | 165 void LinuxSandbox::Seal() { |
164 proc_fd_.reset(); | 166 proc_fd_.reset(); |
165 } | 167 } |
166 | 168 |
167 } // namespace shell | 169 } // namespace shell |
OLD | NEW |