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

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 705 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 #endif 716 #endif
717 return false; 717 return false;
718 } 718 }
719 } 719 }
720 720
721 bool IsAllowedBasicScheduler(int sysno) { 721 bool IsAllowedBasicScheduler(int sysno) {
722 switch (sysno) { 722 switch (sysno) {
723 case __NR_sched_yield: 723 case __NR_sched_yield:
724 case __NR_pause: 724 case __NR_pause:
725 case __NR_nanosleep: 725 case __NR_nanosleep:
726 #if defined(ADDRESS_SANITIZER)
727 // Allow to call sched_getaffinity under AddressSanitizer.
728 case __NR_sched_getaffinity:
729 #endif
726 return true; 730 return true;
727 case __NR_getpriority: 731 case __NR_getpriority:
728 #if defined(__i386__) || defined(__arm__) 732 #if defined(__i386__) || defined(__arm__)
729 case __NR_nice: 733 case __NR_nice:
730 #endif 734 #endif
731 case __NR_setpriority: 735 case __NR_setpriority:
732 default: 736 default:
733 return false; 737 return false;
734 } 738 }
735 } 739 }
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
965 } 969 }
966 } 970 }
967 #endif 971 #endif
968 972
969 bool IsAdvancedScheduler(int sysno) { 973 bool IsAdvancedScheduler(int sysno) {
970 switch (sysno) { 974 switch (sysno) {
971 case __NR_ioprio_get: // IO scheduler. 975 case __NR_ioprio_get: // IO scheduler.
972 case __NR_ioprio_set: 976 case __NR_ioprio_set:
973 case __NR_sched_get_priority_max: 977 case __NR_sched_get_priority_max:
974 case __NR_sched_get_priority_min: 978 case __NR_sched_get_priority_min:
979 #if !defined(ADDRESS_SANITIZER)
980 // Allow to call sched_getaffinity under AddressSanitizer.
975 case __NR_sched_getaffinity: 981 case __NR_sched_getaffinity:
982 #endif
976 case __NR_sched_getparam: 983 case __NR_sched_getparam:
977 case __NR_sched_getscheduler: 984 case __NR_sched_getscheduler:
978 case __NR_sched_rr_get_interval: 985 case __NR_sched_rr_get_interval:
979 case __NR_sched_setaffinity: 986 case __NR_sched_setaffinity:
980 case __NR_sched_setparam: 987 case __NR_sched_setparam:
981 case __NR_sched_setscheduler: 988 case __NR_sched_setscheduler:
982 return true; 989 return true;
983 default: 990 default:
984 return false; 991 return false;
985 } 992 }
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
1245 // dup()'ing an already open file descriptor does not work. 1252 // dup()'ing an already open file descriptor does not work.
1246 // Allow open() even though it severely weakens the sandbox, 1253 // Allow open() even though it severely weakens the sandbox,
1247 // to test the sandboxing mechanism in general. 1254 // to test the sandboxing mechanism in general.
1248 // TODO(jorgelo): remove this once we solve the libva issue. 1255 // TODO(jorgelo): remove this once we solve the libva issue.
1249 return ErrorCode(ErrorCode::ERR_ALLOWED); 1256 return ErrorCode(ErrorCode::ERR_ALLOWED);
1250 } else { 1257 } else {
1251 // Hook open() in the GPU process to allow opening /etc/drirc, 1258 // Hook open() in the GPU process to allow opening /etc/drirc,
1252 // needed by Mesa. 1259 // needed by Mesa.
1253 // The hook needs dup(), lseek(), and close() to be allowed. 1260 // The hook needs dup(), lseek(), and close() to be allowed.
1254 return Sandbox::Trap(GpuOpenSIGSYS_Handler, NULL); 1261 return Sandbox::Trap(GpuOpenSIGSYS_Handler, NULL);
1255 } 1262 }
jln (very slow on Chromium) 2012/12/03 18:43:38 Please add sched_get_affinity here instead.
1256 default: 1263 default:
1257 if (IsEventFd(sysno)) 1264 if (IsEventFd(sysno))
1258 return ErrorCode(ErrorCode::ERR_ALLOWED); 1265 return ErrorCode(ErrorCode::ERR_ALLOWED);
1259 1266
1260 // Default on the baseline policy. 1267 // Default on the baseline policy.
1261 return BaselinePolicy(sysno); 1268 return BaselinePolicy(sysno);
1262 } 1269 }
1263 } 1270 }
1264 1271
1265 ErrorCode RendererOrWorkerProcessPolicy(int sysno, void *) { 1272 ErrorCode RendererOrWorkerProcessPolicy(int sysno, void *) {
1266 switch (sysno) { 1273 switch (sysno) {
1267 case __NR_ioctl: // TODO(jln) investigate legitimate use in the renderer 1274 case __NR_ioctl: // TODO(jln) investigate legitimate use in the renderer
1268 // and see if alternatives can be used. 1275 // and see if alternatives can be used.
1269 case __NR_fdatasync: 1276 case __NR_fdatasync:
1270 case __NR_fsync: 1277 case __NR_fsync:
1271 #if defined(__i386__) || defined(__x86_64__) 1278 #if defined(__i386__) || defined(__x86_64__)
1272 case __NR_getrlimit: 1279 case __NR_getrlimit:
1273 #endif 1280 #endif
1274 case __NR_mremap: // See crbug.com/149834. 1281 case __NR_mremap: // See crbug.com/149834.
1275 case __NR_pread64: 1282 case __NR_pread64:
1276 case __NR_pwrite64: 1283 case __NR_pwrite64:
jln (very slow on Chromium) 2012/12/03 18:43:38 And here.
1277 case __NR_sched_get_priority_max: 1284 case __NR_sched_get_priority_max:
1278 case __NR_sched_get_priority_min: 1285 case __NR_sched_get_priority_min:
1279 case __NR_sched_getparam: 1286 case __NR_sched_getparam:
1280 case __NR_sched_getscheduler: 1287 case __NR_sched_getscheduler:
1281 case __NR_sched_setscheduler: 1288 case __NR_sched_setscheduler:
1282 case __NR_setpriority: 1289 case __NR_setpriority:
1283 case __NR_sysinfo: 1290 case __NR_sysinfo:
1284 case __NR_times: 1291 case __NR_times:
1285 case __NR_uname: 1292 case __NR_uname:
1286 return ErrorCode(ErrorCode::ERR_ALLOWED); 1293 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. 1480 // should enable it, enable it or die.
1474 bool started_sandbox = StartBpfSandbox(command_line, process_type); 1481 bool started_sandbox = StartBpfSandbox(command_line, process_type);
1475 CHECK(started_sandbox); 1482 CHECK(started_sandbox);
1476 return true; 1483 return true;
1477 } 1484 }
1478 #endif 1485 #endif
1479 return false; 1486 return false;
1480 } 1487 }
1481 1488
1482 } // namespace content 1489 } // 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