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: content/common/sandbox_seccomp_bpf_linux.cc

Issue 11418277: Allow ASanified Chrome to use sched_getaffinity (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years 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 | « no previous file | 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 <asm/unistd.h> 5 #include <asm/unistd.h>
6 #include <dlfcn.h> 6 #include <dlfcn.h>
7 #include <errno.h> 7 #include <errno.h>
8 #include <fcntl.h> 8 #include <fcntl.h>
9 #include <linux/audit.h> 9 #include <linux/audit.h>
10 #include <linux/filter.h> 10 #include <linux/filter.h>
(...skipping 1235 matching lines...) Expand 10 before | Expand all | Expand 10 after
1246 // Allow open() even though it severely weakens the sandbox, 1246 // Allow open() even though it severely weakens the sandbox,
1247 // to test the sandboxing mechanism in general. 1247 // to test the sandboxing mechanism in general.
1248 // TODO(jorgelo): remove this once we solve the libva issue. 1248 // TODO(jorgelo): remove this once we solve the libva issue.
1249 return ErrorCode(ErrorCode::ERR_ALLOWED); 1249 return ErrorCode(ErrorCode::ERR_ALLOWED);
1250 } else { 1250 } else {
1251 // Hook open() in the GPU process to allow opening /etc/drirc, 1251 // Hook open() in the GPU process to allow opening /etc/drirc,
1252 // needed by Mesa. 1252 // needed by Mesa.
1253 // The hook needs dup(), lseek(), and close() to be allowed. 1253 // The hook needs dup(), lseek(), and close() to be allowed.
1254 return Sandbox::Trap(GpuOpenSIGSYS_Handler, NULL); 1254 return Sandbox::Trap(GpuOpenSIGSYS_Handler, NULL);
1255 } 1255 }
1256 #if defined(ADDRESS_SANITIZER)
1257 // Allow to call sched_getaffinity under AddressSanitizer.
1258 case __NR_sched_getaffinity:
jln (very slow on Chromium) 2012/12/04 00:16:09 You need to add return ErrorCode(ErrorCode::ERR_AL
1259 #endif
1256 default: 1260 default:
1257 if (IsEventFd(sysno)) 1261 if (IsEventFd(sysno))
1258 return ErrorCode(ErrorCode::ERR_ALLOWED); 1262 return ErrorCode(ErrorCode::ERR_ALLOWED);
1259 1263
1260 // Default on the baseline policy. 1264 // Default on the baseline policy.
1261 return BaselinePolicy(sysno); 1265 return BaselinePolicy(sysno);
1262 } 1266 }
1263 } 1267 }
1264 1268
1265 ErrorCode RendererOrWorkerProcessPolicy(int sysno, void *) { 1269 ErrorCode RendererOrWorkerProcessPolicy(int sysno, void *) {
1266 switch (sysno) { 1270 switch (sysno) {
1267 case __NR_ioctl: // TODO(jln) investigate legitimate use in the renderer 1271 case __NR_ioctl: // TODO(jln) investigate legitimate use in the renderer
1268 // and see if alternatives can be used. 1272 // and see if alternatives can be used.
1269 case __NR_fdatasync: 1273 case __NR_fdatasync:
1270 case __NR_fsync: 1274 case __NR_fsync:
1271 #if defined(__i386__) || defined(__x86_64__) 1275 #if defined(__i386__) || defined(__x86_64__)
1272 case __NR_getrlimit: 1276 case __NR_getrlimit:
1273 #endif 1277 #endif
1274 case __NR_mremap: // See crbug.com/149834. 1278 case __NR_mremap: // See crbug.com/149834.
1275 case __NR_pread64: 1279 case __NR_pread64:
1276 case __NR_pwrite64: 1280 case __NR_pwrite64:
1281 #if defined(ADDRESS_SANITIZER)
1282 // Allow to call sched_getaffinity() under AddressSanitizer.
1283 case __NR_sched_getaffinity:
1284 #endif
1277 case __NR_sched_get_priority_max: 1285 case __NR_sched_get_priority_max:
1278 case __NR_sched_get_priority_min: 1286 case __NR_sched_get_priority_min:
1279 case __NR_sched_getparam: 1287 case __NR_sched_getparam:
1280 case __NR_sched_getscheduler: 1288 case __NR_sched_getscheduler:
1281 case __NR_sched_setscheduler: 1289 case __NR_sched_setscheduler:
1282 case __NR_setpriority: 1290 case __NR_setpriority:
1283 case __NR_sysinfo: 1291 case __NR_sysinfo:
1284 case __NR_times: 1292 case __NR_times:
1285 case __NR_uname: 1293 case __NR_uname:
1286 return ErrorCode(ErrorCode::ERR_ALLOWED); 1294 return ErrorCode(ErrorCode::ERR_ALLOWED);
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
1473 // should enable it, enable it or die. 1481 // should enable it, enable it or die.
1474 bool started_sandbox = StartBpfSandbox(command_line, process_type); 1482 bool started_sandbox = StartBpfSandbox(command_line, process_type);
1475 CHECK(started_sandbox); 1483 CHECK(started_sandbox);
1476 return true; 1484 return true;
1477 } 1485 }
1478 #endif 1486 #endif
1479 return false; 1487 return false;
1480 } 1488 }
1481 1489
1482 } // namespace content 1490 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698