Chromium Code Reviews| 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/services/credentials.h" | 5 #include "sandbox/linux/services/credentials.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 <stdio.h> | 10 #include <stdio.h> |
| 10 #include <sys/capability.h> | 11 #include <sys/capability.h> |
| 11 #include <sys/stat.h> | 12 #include <sys/stat.h> |
| 12 #include <sys/types.h> | 13 #include <sys/types.h> |
| 13 #include <unistd.h> | 14 #include <unistd.h> |
| 14 | 15 |
| 15 #include <vector> | 16 #include <vector> |
| 16 | 17 |
| 17 #include "base/files/file_path.h" | 18 #include "base/files/file_path.h" |
| 18 #include "base/files/file_util.h" | 19 #include "base/files/file_util.h" |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 230 | 231 |
| 231 const cap_value_t allowed_cap = CAP_SYS_CHROOT; | 232 const cap_value_t allowed_cap = CAP_SYS_CHROOT; |
| 232 for (const cap_flag_t flag : {CAP_EFFECTIVE, CAP_PERMITTED}) { | 233 for (const cap_flag_t flag : {CAP_EFFECTIVE, CAP_PERMITTED}) { |
| 233 PCHECK(cap_set_flag(expected_cap.get(), flag, 1, &allowed_cap, CAP_SET) == | 234 PCHECK(cap_set_flag(expected_cap.get(), flag, 1, &allowed_cap, CAP_SET) == |
| 234 0); | 235 0); |
| 235 } | 236 } |
| 236 | 237 |
| 237 CHECK_EQ(0, cap_compare(expected_cap.get(), actual_cap.get())); | 238 CHECK_EQ(0, cap_compare(expected_cap.get(), actual_cap.get())); |
| 238 } | 239 } |
| 239 | 240 |
| 241 // Disabled on ASAN because of crbug.com/451603. | |
| 242 SANDBOX_TEST(Credentials, DISABLE_ON_ASAN(DropFileSystemAccessPreservesTLS)) { | |
| 243 // Probably missing kernel support. | |
| 244 if (!Credentials::MoveToNewUserNS()) return; | |
| 245 CHECK(Credentials::DropFileSystemAccess(ProcUtil::OpenProc().get())); | |
| 246 | |
| 247 // In glibc, pthread_getattr_np makes an assertion about the cached PID/TID in | |
| 248 // TLS. | |
| 249 pthread_attr_t attr; | |
| 250 EXPECT_EQ(0, pthread_getattr_np(pthread_self(), &attr)); | |
| 251 } | |
| 252 | |
|
jln (very slow on Chromium)
2015/07/21 23:39:17
Could you add another test that creates a thread t
rickyz (no longer on Chrome)
2015/07/22 04:00:32
Sorry, I wasn't quite sure what kind of test you w
jln (very slow on Chromium)
2015/07/22 17:30:06
Yeah, sorry I meant another "thread" with the vfor
| |
| 240 } // namespace. | 253 } // namespace. |
| 241 | 254 |
| 242 } // namespace sandbox. | 255 } // namespace sandbox. |
| OLD | NEW |