Chromium Code Reviews

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

Issue 1617763002: sandbox arm64: align stack 16 bytes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sandbox arm64: align stack 16 bytes Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
« base/process/launch_posix.cc ('K') | « base/process/launch_posix.cc ('k') | no next file » | 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...)
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]; 97 char stack_buf[PTHREAD_STACK_MIN] __attribute__((aligned(16)));
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_MIPS64_FAMILY) || defined(ARCH_CPU_MIPS_FAMILY) 99 defined(ARCH_CPU_MIPS64_FAMILY) || 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 218 matching lines...)
326 if (pid != 0) { 326 if (pid != 0) {
327 return pid; 327 return pid;
328 } 328 }
329 329
330 // Since we just forked, we are single threaded. 330 // Since we just forked, we are single threaded.
331 PCHECK(DropAllCapabilitiesOnCurrentThread()); 331 PCHECK(DropAllCapabilitiesOnCurrentThread());
332 return 0; 332 return 0;
333 } 333 }
334 334
335 } // namespace sandbox. 335 } // namespace sandbox.
OLDNEW
« base/process/launch_posix.cc ('K') | « base/process/launch_posix.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine