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

Side by Side Diff: sandbox/linux/services/credentials_unittest.cc

Issue 1248673004: Set a new TLS when using CLONE_VM. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Respond to comments Created 5 years, 5 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 unified diff | Download patch
OLDNEW
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
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
240 } // namespace. 253 } // namespace.
241 254
242 } // namespace sandbox. 255 } // namespace sandbox.
OLDNEW
« sandbox/linux/services/credentials.cc ('K') | « sandbox/linux/services/credentials.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698