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

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

Issue 14771026: Linux: remove unmaintained SELinux code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « sandbox/linux/services/libc_urandom_override.h ('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) 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/libc_urandom_override.h" 5 #include "sandbox/linux/services/libc_urandom_override.h"
6 6
7 #include <dlfcn.h> 7 #include <dlfcn.h>
8 #include <pthread.h> 8 #include <pthread.h>
9 #include <stdio.h> 9 #include <stdio.h>
10 #include <sys/stat.h> 10 #include <sys/stat.h>
11 #include <unistd.h> 11 #include <unistd.h>
12 12
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/posix/eintr_wrapper.h" 14 #include "base/posix/eintr_wrapper.h"
15 #include "base/rand_util.h" 15 #include "base/rand_util.h"
16 16
17 // Note: this file is used by the zygote and nacl_helper. 17 // Note: this file is used by the zygote and nacl_helper.
18 18
19 namespace sandbox { 19 namespace sandbox {
20 20
21 // With SELinux we can carve out a precise sandbox, so we don't have to play
22 // with intercepting libc calls.
23 #if !defined(CHROMIUM_SELINUX)
24
25 static bool g_override_urandom = false; 21 static bool g_override_urandom = false;
26 22
27 void InitLibcUrandomOverrides() { 23 void InitLibcUrandomOverrides() {
28 // Make sure /dev/urandom is open. 24 // Make sure /dev/urandom is open.
29 base::GetUrandomFD(); 25 base::GetUrandomFD();
30 g_override_urandom = true; 26 g_override_urandom = true;
31 } 27 }
32 28
33 // TODO(sergeyu): Currently this code doesn't work properly under ASAN 29 // TODO(sergeyu): Currently this code doesn't work properly under ASAN
34 // - it crashes content_unittests. Make sure it works properly and 30 // - it crashes content_unittests. Make sure it works properly and
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 } else { 151 } else {
156 CHECK_EQ(0, pthread_once(&g_libc_file_io_funcs_guard, 152 CHECK_EQ(0, pthread_once(&g_libc_file_io_funcs_guard,
157 InitLibcFileIOFunctions)); 153 InitLibcFileIOFunctions));
158 CHECK(g_libc_xstat64); 154 CHECK(g_libc_xstat64);
159 return g_libc_xstat64(version, path, buf); 155 return g_libc_xstat64(version, path, buf);
160 } 156 }
161 } 157 }
162 158
163 #endif // !ADDRESS_SANITIZER 159 #endif // !ADDRESS_SANITIZER
164 160
165 #endif // !CHROMIUM_SELINUX
166
167 } // namespace content 161 } // namespace content
OLDNEW
« no previous file with comments | « sandbox/linux/services/libc_urandom_override.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698