OLD | NEW |
---|---|
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 "sandbox/linux/bpf_dsl/bpf_dsl.h" | 5 #include "sandbox/linux/bpf_dsl/bpf_dsl.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <fcntl.h> | 8 #include <fcntl.h> |
9 #include <pthread.h> | 9 #include <pthread.h> |
10 #include <sched.h> | 10 #include <sched.h> |
(...skipping 2249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2260 } | 2260 } |
2261 | 2261 |
2262 BPF_ASSERT(event->IsSignaled()); | 2262 BPF_ASSERT(event->IsSignaled()); |
2263 | 2263 |
2264 BlacklistNanosleepPolicy::AssertNanosleepFails(); | 2264 BlacklistNanosleepPolicy::AssertNanosleepFails(); |
2265 | 2265 |
2266 return NULL; | 2266 return NULL; |
2267 } | 2267 } |
2268 | 2268 |
2269 SANDBOX_TEST(SandboxBPF, Tsync) { | 2269 SANDBOX_TEST(SandboxBPF, Tsync) { |
2270 if (SandboxBPF::SupportsSeccompThreadFilterSynchronization() != | 2270 SandboxBPF::SandboxStatus sandbox_status = |
2271 SandboxBPF::STATUS_AVAILABLE) { | 2271 SandboxBPF::SupportsSeccompThreadFilterSynchronization(); |
jln (very slow on Chromium)
2014/11/26 22:22:33
This is a very outdated API, you should re-sync :)
| |
2272 #if defined(OS_CHROMEOS) | |
jln (very slow on Chromium)
2014/11/26 22:22:33
This won't work unfortunately.
OS_CHROMEOS is jus
| |
2273 BPF_ASSERT_EQ(SandboxBPF::STATUS_AVAILABLE, sandbox_status); | |
2274 #else | |
2275 if (sandbox_status != SandboxBPF::STATUS_AVAILABLE) { | |
2272 return; | 2276 return; |
2273 } | 2277 } |
2278 #endif | |
2274 | 2279 |
2275 base::WaitableEvent event(true, false); | 2280 base::WaitableEvent event(true, false); |
2276 | 2281 |
2277 // Create a thread on which to invoke the blocked syscall. | 2282 // Create a thread on which to invoke the blocked syscall. |
2278 pthread_t thread; | 2283 pthread_t thread; |
2279 BPF_ASSERT_EQ( | 2284 BPF_ASSERT_EQ( |
2280 0, pthread_create(&thread, NULL, &TsyncApplyToTwoThreadsFunc, &event)); | 2285 0, pthread_create(&thread, NULL, &TsyncApplyToTwoThreadsFunc, &event)); |
2281 | 2286 |
2282 // Test that nanoseelp success. | 2287 // Test that nanoseelp success. |
2283 const struct timespec ts = {0, 0}; | 2288 const struct timespec ts = {0, 0}; |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2394 BPF_ASSERT_EQ(ENOSYS, errno); | 2399 BPF_ASSERT_EQ(ENOSYS, errno); |
2395 | 2400 |
2396 BPF_ASSERT_EQ(-1, syscall(__NR_setgid, 300)); | 2401 BPF_ASSERT_EQ(-1, syscall(__NR_setgid, 300)); |
2397 BPF_ASSERT_EQ(EPERM, errno); | 2402 BPF_ASSERT_EQ(EPERM, errno); |
2398 } | 2403 } |
2399 | 2404 |
2400 } // namespace | 2405 } // namespace |
2401 | 2406 |
2402 } // namespace bpf_dsl | 2407 } // namespace bpf_dsl |
2403 } // namespace sandbox | 2408 } // namespace sandbox |
OLD | NEW |