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

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

Issue 2670873002: Remove base's ALIGNOF/ALIGNAS in favor of alignof/alignas. (Closed)
Patch Set: rebase Created 3 years, 10 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
« no previous file with comments | « net/quic/platform/impl/quic_aligned_impl.h ('k') | styleguide/c++/c++11.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 <limits.h> 8 #include <limits.h>
9 #include <signal.h> 9 #include <signal.h>
10 #include <stddef.h> 10 #include <stddef.h>
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 bool ChrootToSafeEmptyDir() { 87 bool ChrootToSafeEmptyDir() {
88 // We need to chroot to a fdinfo that is unique to a process and have that 88 // We need to chroot to a fdinfo that is unique to a process and have that
89 // process die. 89 // process die.
90 // 1. We don't want to simply fork() because duplicating the page tables is 90 // 1. We don't want to simply fork() because duplicating the page tables is
91 // slow with a big address space. 91 // slow with a big address space.
92 // 2. We do not use a regular thread (that would unshare CLONE_FILES) because 92 // 2. We do not use a regular thread (that would unshare CLONE_FILES) because
93 // when we are in a PID namespace, we cannot easily get a handle to the 93 // when we are in a PID namespace, we cannot easily get a handle to the
94 // /proc/tid directory for the thread (since /proc may not be aware of the 94 // /proc/tid directory for the thread (since /proc may not be aware of the
95 // PID namespace). With a process, we can just use /proc/self. 95 // PID namespace). With a process, we can just use /proc/self.
96 pid_t pid = -1; 96 pid_t pid = -1;
97 char stack_buf[PTHREAD_STACK_MIN] ALIGNAS(16); 97 alignas(16) char stack_buf[PTHREAD_STACK_MIN];
98 #if defined(ARCH_CPU_X86_FAMILY) || defined(ARCH_CPU_ARM_FAMILY) || \ 98 #if defined(ARCH_CPU_X86_FAMILY) || defined(ARCH_CPU_ARM_FAMILY) || \
99 defined(ARCH_CPU_MIPS_FAMILY) 99 defined(ARCH_CPU_MIPS_FAMILY)
100 // The stack grows downward. 100 // The stack grows downward.
101 void* stack = stack_buf + sizeof(stack_buf); 101 void* stack = stack_buf + sizeof(stack_buf);
102 #else 102 #else
103 #error "Unsupported architecture" 103 #error "Unsupported architecture"
104 #endif 104 #endif
105 105
106 int clone_flags = CLONE_FS | LINUX_SIGCHLD; 106 int clone_flags = CLONE_FS | LINUX_SIGCHLD;
107 void* tls = nullptr; 107 void* tls = nullptr;
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 if (pid != 0) { 347 if (pid != 0) {
348 return pid; 348 return pid;
349 } 349 }
350 350
351 // Since we just forked, we are single threaded. 351 // Since we just forked, we are single threaded.
352 PCHECK(DropAllCapabilitiesOnCurrentThread()); 352 PCHECK(DropAllCapabilitiesOnCurrentThread());
353 return 0; 353 return 0;
354 } 354 }
355 355
356 } // namespace sandbox. 356 } // namespace sandbox.
OLDNEW
« no previous file with comments | « net/quic/platform/impl/quic_aligned_impl.h ('k') | styleguide/c++/c++11.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698