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

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

Issue 1172183002: Move StartsWith[ASCII] to base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@string_util3
Patch Set: merger Created 5 years, 6 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 | « rlz/win/lib/machine_deal.cc ('k') | storage/browser/blob/blob_url_request_job_factory.cc » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <errno.h> 5 #include <errno.h>
6 #include <fcntl.h> 6 #include <fcntl.h>
7 #include <sys/ptrace.h> 7 #include <sys/ptrace.h>
8 #include <sys/stat.h> 8 #include <sys/stat.h>
9 #include <sys/types.h> 9 #include <sys/types.h>
10 #include <unistd.h> 10 #include <unistd.h>
(...skipping 12 matching lines...) Expand all
23 23
24 namespace { 24 namespace {
25 25
26 bool HasLinux32Bug() { 26 bool HasLinux32Bug() {
27 #if defined(__i386__) 27 #if defined(__i386__)
28 // On 3.2 kernels, yama doesn't work for 32-bit binaries on 64-bit kernels. 28 // On 3.2 kernels, yama doesn't work for 32-bit binaries on 64-bit kernels.
29 // This is fixed in 3.4. 29 // This is fixed in 3.4.
30 bool is_kernel_64bit = 30 bool is_kernel_64bit =
31 base::SysInfo::OperatingSystemArchitecture() == "x86_64"; 31 base::SysInfo::OperatingSystemArchitecture() == "x86_64";
32 bool is_linux = base::SysInfo::OperatingSystemName() == "Linux"; 32 bool is_linux = base::SysInfo::OperatingSystemName() == "Linux";
33 bool is_3_dot_2 = StartsWithASCII( 33 bool is_3_dot_2 = base::StartsWithASCII(
34 base::SysInfo::OperatingSystemVersion(), "3.2", /*case_sensitive=*/false); 34 base::SysInfo::OperatingSystemVersion(), "3.2", /*case_sensitive=*/false);
35 if (is_kernel_64bit && is_linux && is_3_dot_2) 35 if (is_kernel_64bit && is_linux && is_3_dot_2)
36 return true; 36 return true;
37 #endif // defined(__i386__) 37 #endif // defined(__i386__)
38 return false; 38 return false;
39 } 39 }
40 40
41 bool CanPtrace(pid_t pid) { 41 bool CanPtrace(pid_t pid) {
42 int ret; 42 int ret;
43 ret = ptrace(PTRACE_ATTACH, pid, NULL, NULL); 43 ret = ptrace(PTRACE_ATTACH, pid, NULL, NULL);
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 if (Yama::IsEnforcing()) { 163 if (Yama::IsEnforcing()) {
164 // Check that process1 is protected by Yama, even though it has 164 // Check that process1 is protected by Yama, even though it has
165 // been created from a process that disabled Yama. 165 // been created from a process that disabled Yama.
166 CHECK(!CanSubProcessPtrace(process1.GetPid())); 166 CHECK(!CanSubProcessPtrace(process1.GetPid()));
167 } 167 }
168 } 168 }
169 169
170 } // namespace 170 } // namespace
171 171
172 } // namespace sandbox 172 } // namespace sandbox
OLDNEW
« no previous file with comments | « rlz/win/lib/machine_deal.cc ('k') | storage/browser/blob/blob_url_request_job_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698