OLD | NEW |
---|---|
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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
146 int flags = static_cast<int>(arg1); | 146 int flags = static_cast<int>(arg1); |
147 | 147 |
148 if (strcmp(pathname, kDriRcPath) == 0) { | 148 if (strcmp(pathname, kDriRcPath) == 0) { |
149 int ret = OpenWithCache(pathname, flags); | 149 int ret = OpenWithCache(pathname, flags); |
150 return (ret == -1) ? -errno : ret; | 150 return (ret == -1) ? -errno : ret; |
151 } else { | 151 } else { |
152 return -ENOENT; | 152 return -ENOENT; |
153 } | 153 } |
154 } | 154 } |
155 | 155 |
156 #if defined(__i386__) || defined(__x86_64__) | 156 #if defined(__i386__) || defined(__x86_64__) || defined(__arm__) |
jln (very slow on Chromium)
2012/08/16 20:45:08
I think we don't need this line at all now. Hurray
Jorge Lucangeli Obes
2012/08/16 21:32:08
Done.
| |
157 | 157 |
158 // The functions below cover all existing x86_64 and i386 system calls. | 158 // The functions below cover all existing x86_64 and i386 system calls. |
jln (very slow on Chromium)
2012/08/16 20:45:08
You now have the privilege to add an architecture
Jorge Lucangeli Obes
2012/08/16 21:32:08
Done.
| |
159 // The implicitly defined sets form a partition of the sets of | 159 // The implicitly defined sets form a partition of the sets of |
160 // system calls. | 160 // system calls. |
161 | 161 |
162 // TODO(jln) we need to restrict the first parameter! | 162 // TODO(jln) we need to restrict the first parameter! |
163 bool IsKill(int sysno) { | 163 bool IsKill(int sysno) { |
164 switch (sysno) { | 164 switch (sysno) { |
165 case __NR_kill: | 165 case __NR_kill: |
166 case __NR_tkill: | 166 case __NR_tkill: |
167 case __NR_tgkill: | 167 case __NR_tgkill: |
168 return true; | 168 return true; |
169 default: | 169 default: |
170 return false; | 170 return false; |
171 } | 171 } |
172 } | 172 } |
173 | 173 |
174 bool IsAllowedGettime(int sysno) { | 174 bool IsAllowedGettime(int sysno) { |
175 switch (sysno) { | 175 switch (sysno) { |
176 case __NR_clock_gettime: | 176 case __NR_clock_gettime: |
177 case __NR_gettimeofday: | 177 case __NR_gettimeofday: |
178 #if defined(__i386__) || defined(__x86_64__) | |
178 case __NR_time: | 179 case __NR_time: |
180 #endif | |
179 return true; | 181 return true; |
180 case __NR_adjtimex: // Privileged. | 182 case __NR_adjtimex: // Privileged. |
181 case __NR_clock_adjtime: // Privileged. | 183 case __NR_clock_adjtime: // Privileged. |
182 case __NR_clock_getres: // Could be allowed. | 184 case __NR_clock_getres: // Could be allowed. |
183 case __NR_clock_nanosleep: // Could be allowed. | 185 case __NR_clock_nanosleep: // Could be allowed. |
184 case __NR_clock_settime: // Privileged. | 186 case __NR_clock_settime: // Privileged. |
185 #if defined(__i386__) | 187 #if defined(__i386__) |
186 case __NR_ftime: // Obsolete. | 188 case __NR_ftime: // Obsolete. |
187 #endif | 189 #endif |
188 case __NR_settimeofday: // Privileged. | 190 case __NR_settimeofday: // Privileged. |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
272 case __NR_symlink: | 274 case __NR_symlink: |
273 case __NR_symlinkat: | 275 case __NR_symlinkat: |
274 case __NR_truncate: | 276 case __NR_truncate: |
275 #if defined(__i386__) | 277 #if defined(__i386__) |
276 case __NR_truncate64: | 278 case __NR_truncate64: |
277 #endif | 279 #endif |
278 case __NR_unlink: | 280 case __NR_unlink: |
279 case __NR_unlinkat: | 281 case __NR_unlinkat: |
280 case __NR_uselib: // Neither EPERM, nor ENOENT are valid errno. | 282 case __NR_uselib: // Neither EPERM, nor ENOENT are valid errno. |
281 case __NR_ustat: // Same as above. Deprecated. | 283 case __NR_ustat: // Same as above. Deprecated. |
284 #if defined(__i386__) || defined(__x86_64__) | |
282 case __NR_utime: | 285 case __NR_utime: |
286 #endif | |
283 case __NR_utimensat: // New. | 287 case __NR_utimensat: // New. |
284 case __NR_utimes: | 288 case __NR_utimes: |
285 return true; | 289 return true; |
286 default: | 290 default: |
287 return false; | 291 return false; |
288 } | 292 } |
289 } | 293 } |
290 | 294 |
291 bool IsAllowedFileSystemAccessViaFd(int sysno) { | 295 bool IsAllowedFileSystemAccessViaFd(int sysno) { |
292 switch (sysno) { | 296 switch (sysno) { |
293 case __NR_fstat: | 297 case __NR_fstat: |
294 #if defined(__i386__) | 298 #if defined(__i386__) |
295 case __NR_fstat64: | 299 case __NR_fstat64: |
296 #endif | 300 #endif |
297 return true; | 301 return true; |
298 // TODO(jln): these should be denied gracefully as well (moved below). | 302 // TODO(jln): these should be denied gracefully as well (moved below). |
303 #if defined(__i386__) || defined(__x86_64__) | |
299 case __NR_fadvise64: // EPERM not a valid errno. | 304 case __NR_fadvise64: // EPERM not a valid errno. |
305 #endif | |
300 #if defined(__i386__) | 306 #if defined(__i386__) |
301 case __NR_fadvise64_64: | 307 case __NR_fadvise64_64: |
302 #endif | 308 #endif |
309 #if defined(__arm__) | |
310 case __NR_arm_fadvise64_64: | |
311 #endif | |
303 case __NR_fdatasync: // EPERM not a valid errno. | 312 case __NR_fdatasync: // EPERM not a valid errno. |
304 case __NR_flock: // EPERM not a valid errno. | 313 case __NR_flock: // EPERM not a valid errno. |
305 case __NR_fstatfs: // Give information about the whole filesystem. | 314 case __NR_fstatfs: // Give information about the whole filesystem. |
306 #if defined(__i386__) | 315 #if defined(__i386__) |
307 case __NR_fstatfs64: | 316 case __NR_fstatfs64: |
308 #endif | 317 #endif |
309 case __NR_fsync: // EPERM not a valid errno. | 318 case __NR_fsync: // EPERM not a valid errno. |
310 #if defined(__i386__) | 319 #if defined(__i386__) |
311 case __NR_oldfstat: | 320 case __NR_oldfstat: |
312 #endif | 321 #endif |
313 case __NR_sync_file_range: // EPERM not a valid errno. | 322 #if defined(__i386__) || defined(__x86_64__) |
323 case __NR_sync_file_range: // EPERM not a valid errno. | |
324 #else // defined(__arm__) | |
jln (very slow on Chromium)
2012/08/16 20:45:08
Please, make this a #elif.
Jorge Lucangeli Obes
2012/08/16 21:32:08
Done.
| |
325 case __NR_arm_sync_file_range: // EPERM not a valid errno. | |
326 #endif | |
314 default: | 327 default: |
315 return false; | 328 return false; |
316 } | 329 } |
317 } | 330 } |
318 | 331 |
319 // EPERM is a good errno for any of these. | 332 // EPERM is a good errno for any of these. |
320 bool IsDeniedFileSystemAccessViaFd(int sysno) { | 333 bool IsDeniedFileSystemAccessViaFd(int sysno) { |
321 switch (sysno) { | 334 switch (sysno) { |
322 case __NR_fallocate: | 335 case __NR_fallocate: |
323 case __NR_fchmod: | 336 case __NR_fchmod: |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
377 #endif | 390 #endif |
378 return true; | 391 return true; |
379 default: | 392 default: |
380 return false; | 393 return false; |
381 } | 394 } |
382 } | 395 } |
383 | 396 |
384 bool IsProcessPrivilegeChange(int sysno) { | 397 bool IsProcessPrivilegeChange(int sysno) { |
385 switch (sysno) { | 398 switch (sysno) { |
386 case __NR_capset: | 399 case __NR_capset: |
400 #if defined(__i386__) || defined(__x86_64__) | |
387 case __NR_ioperm: // Intel privilege. | 401 case __NR_ioperm: // Intel privilege. |
388 case __NR_iopl: // Intel privilege. | 402 case __NR_iopl: // Intel privilege. |
403 #endif | |
389 case __NR_setfsgid: | 404 case __NR_setfsgid: |
390 case __NR_setfsuid: | 405 case __NR_setfsuid: |
391 case __NR_setgid: | 406 case __NR_setgid: |
392 case __NR_setgroups: | 407 case __NR_setgroups: |
393 case __NR_setregid: | 408 case __NR_setregid: |
394 case __NR_setresgid: | 409 case __NR_setresgid: |
395 case __NR_setresuid: | 410 case __NR_setresuid: |
396 case __NR_setreuid: | 411 case __NR_setreuid: |
397 case __NR_setuid: | 412 case __NR_setuid: |
398 #if defined(__i386__) | 413 #if defined(__i386__) |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
467 #endif | 482 #endif |
468 #if defined(__x86_64__) | 483 #if defined(__x86_64__) |
469 case __NR_shutdown: | 484 case __NR_shutdown: |
470 #endif | 485 #endif |
471 return true; | 486 return true; |
472 default: | 487 default: |
473 return false; | 488 return false; |
474 } | 489 } |
475 } | 490 } |
476 | 491 |
477 bool IsKernelInteralApi(int sysno) { | 492 bool IsKernelInternalApi(int sysno) { |
478 switch (sysno) { | 493 switch (sysno) { |
479 case __NR_restart_syscall: | 494 case __NR_restart_syscall: |
495 #if defined(__arm__) | |
496 case __ARM_NR_cmpxchg: | |
497 #endif | |
480 return true; | 498 return true; |
481 default: | 499 default: |
482 return false; | 500 return false; |
483 } | 501 } |
484 } | 502 } |
485 | 503 |
486 // This should be thought through in conjunction with IsFutex(). | 504 // This should be thought through in conjunction with IsFutex(). |
487 bool IsAllowedProcessStartOrDeath(int sysno) { | 505 bool IsAllowedProcessStartOrDeath(int sysno) { |
488 switch (sysno) { | 506 switch (sysno) { |
489 case __NR_clone: // TODO(jln): restrict flags. | 507 case __NR_clone: // TODO(jln): restrict flags. |
490 case __NR_exit: | 508 case __NR_exit: |
491 case __NR_exit_group: | 509 case __NR_exit_group: |
492 case __NR_wait4: | 510 case __NR_wait4: |
493 case __NR_waitid: | 511 case __NR_waitid: |
494 #if defined(__i386__) | 512 #if defined(__i386__) |
495 case __NR_waitpid: | 513 case __NR_waitpid: |
496 #endif | 514 #endif |
497 return true; | 515 return true; |
498 case __NR_setns: // Privileged. | 516 case __NR_setns: // Privileged. |
499 case __NR_fork: | 517 case __NR_fork: |
518 #if defined(__i386__) || defined(__x86_64__) | |
500 case __NR_get_thread_area: | 519 case __NR_get_thread_area: |
501 case __NR_set_thread_area: | 520 case __NR_set_thread_area: |
521 #endif | |
502 case __NR_set_tid_address: | 522 case __NR_set_tid_address: |
503 case __NR_unshare: | 523 case __NR_unshare: |
504 case __NR_vfork: | 524 case __NR_vfork: |
505 default: | 525 default: |
506 return false; | 526 return false; |
507 } | 527 } |
508 } | 528 } |
509 | 529 |
510 // It's difficult to restrict those, but there is attack surface here. | 530 // It's difficult to restrict those, but there is attack surface here. |
511 bool IsFutex(int sysno) { | 531 bool IsFutex(int sysno) { |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
583 return false; | 603 return false; |
584 } | 604 } |
585 } | 605 } |
586 #endif | 606 #endif |
587 | 607 |
588 bool IsAllowedAddressSpaceAccess(int sysno) { | 608 bool IsAllowedAddressSpaceAccess(int sysno) { |
589 switch (sysno) { | 609 switch (sysno) { |
590 case __NR_brk: | 610 case __NR_brk: |
591 case __NR_madvise: | 611 case __NR_madvise: |
592 case __NR_mlock: | 612 case __NR_mlock: |
613 #if defined(__i386__) || defined(__x86_64__) | |
593 case __NR_mmap: // TODO(jln): to restrict flags. | 614 case __NR_mmap: // TODO(jln): to restrict flags. |
jln (very slow on Chromium)
2012/08/16 20:45:08
I'm pretty certain arm has mmap(). Maybe it's call
Jorge Lucangeli Obes
2012/08/16 21:32:08
It's explicitly undefined in unistd.h and marked O
| |
594 #if defined(__i386__) | 615 #endif |
616 #if defined(__i386__) || defined(__arm__) | |
595 case __NR_mmap2: | 617 case __NR_mmap2: |
596 #endif | 618 #endif |
597 case __NR_mprotect: | 619 case __NR_mprotect: |
598 case __NR_munlock: | 620 case __NR_munlock: |
599 case __NR_munmap: | 621 case __NR_munmap: |
600 return true; | 622 return true; |
601 case __NR_mincore: | 623 case __NR_mincore: |
602 case __NR_mlockall: | 624 case __NR_mlockall: |
625 #if defined(__i386__) || defined(__x86_64__) | |
603 case __NR_modify_ldt: | 626 case __NR_modify_ldt: |
627 #endif | |
604 case __NR_mremap: | 628 case __NR_mremap: |
605 case __NR_msync: | 629 case __NR_msync: |
606 case __NR_munlockall: | 630 case __NR_munlockall: |
607 case __NR_readahead: | 631 case __NR_readahead: |
608 case __NR_remap_file_pages: | 632 case __NR_remap_file_pages: |
609 #if defined(__i386__) | 633 #if defined(__i386__) |
610 case __NR_vm86: | 634 case __NR_vm86: |
611 case __NR_vm86old: | 635 case __NR_vm86old: |
612 #endif | 636 #endif |
613 default: | 637 default: |
614 return false; | 638 return false; |
615 } | 639 } |
616 } | 640 } |
617 | 641 |
618 bool IsAllowedGeneralIo(int sysno) { | 642 bool IsAllowedGeneralIo(int sysno) { |
619 switch (sysno) { | 643 switch (sysno) { |
620 case __NR_lseek: | 644 case __NR_lseek: |
621 #if defined(__i386__) | 645 #if defined(__i386__) |
622 case __NR__llseek: | 646 case __NR__llseek: |
623 #endif | 647 #endif |
624 case __NR_poll: | 648 case __NR_poll: |
625 case __NR_ppoll: | 649 case __NR_ppoll: |
626 case __NR_pselect6: | 650 case __NR_pselect6: |
627 case __NR_read: | 651 case __NR_read: |
628 case __NR_readv: | 652 case __NR_readv: |
653 #if defined(__arm__) | |
654 case __NR_recv: | |
655 #endif | |
629 #if defined(__x86_64__) | 656 #if defined(__x86_64__) |
630 case __NR_recvfrom: // Could specify source. | 657 case __NR_recvfrom: // Could specify source. |
631 case __NR_recvmsg: // Could specify source. | 658 case __NR_recvmsg: // Could specify source. |
632 #endif | 659 #endif |
660 #if defined(__i386__) || defined(__x86_64__) | |
633 case __NR_select: | 661 case __NR_select: |
634 #if defined(__i386__) | 662 #endif |
663 #if defined(__i386__) || defined(__arm__) | |
635 case __NR__newselect: | 664 case __NR__newselect: |
636 #endif | 665 #endif |
666 #if defined(__arm__) | |
667 case __NR_send: | |
668 #endif | |
637 #if defined(__x86_64__) | 669 #if defined(__x86_64__) |
638 case __NR_sendmsg: // Could specify destination. | 670 case __NR_sendmsg: // Could specify destination. |
639 case __NR_sendto: // Could specify destination. | 671 case __NR_sendto: // Could specify destination. |
640 #endif | 672 #endif |
641 case __NR_write: | 673 case __NR_write: |
642 case __NR_writev: | 674 case __NR_writev: |
643 return true; | 675 return true; |
644 case __NR_ioctl: // Can be very powerful. | 676 case __NR_ioctl: // Can be very powerful. |
645 case __NR_pread64: | 677 case __NR_pread64: |
646 case __NR_preadv: | 678 case __NR_preadv: |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
699 case __NR_sethostname: | 731 case __NR_sethostname: |
700 case __NR_syslog: | 732 case __NR_syslog: |
701 return true; | 733 return true; |
702 default: | 734 default: |
703 return false; | 735 return false; |
704 } | 736 } |
705 } | 737 } |
706 | 738 |
707 bool IsKernelModule(int sysno) { | 739 bool IsKernelModule(int sysno) { |
708 switch (sysno) { | 740 switch (sysno) { |
741 #if defined(__i386__) || defined(__x86_64__) | |
jln (very slow on Chromium)
2012/08/16 20:45:08
Feel free to collapse these in one big #if defined
Jorge Lucangeli Obes
2012/08/16 21:32:08
Done.
| |
709 case __NR_create_module: | 742 case __NR_create_module: |
743 #endif | |
710 case __NR_delete_module: | 744 case __NR_delete_module: |
745 #if defined(__i386__) || defined(__x86_64__) | |
711 case __NR_get_kernel_syms: // Should ENOSYS. | 746 case __NR_get_kernel_syms: // Should ENOSYS. |
747 #endif | |
712 case __NR_init_module: | 748 case __NR_init_module: |
749 #if defined(__i386__) || defined(__x86_64__) | |
713 case __NR_query_module: | 750 case __NR_query_module: |
751 #endif | |
714 return true; | 752 return true; |
715 default: | 753 default: |
716 return false; | 754 return false; |
717 } | 755 } |
718 } | 756 } |
719 | 757 |
720 bool IsGlobalFSViewChange(int sysno) { | 758 bool IsGlobalFSViewChange(int sysno) { |
721 switch (sysno) { | 759 switch (sysno) { |
722 case __NR_pivot_root: | 760 case __NR_pivot_root: |
723 case __NR_chroot: | 761 case __NR_chroot: |
(...skipping 19 matching lines...) Expand all Loading... | |
743 default: | 781 default: |
744 return false; | 782 return false; |
745 } | 783 } |
746 } | 784 } |
747 | 785 |
748 bool IsNuma(int sysno) { | 786 bool IsNuma(int sysno) { |
749 switch (sysno) { | 787 switch (sysno) { |
750 case __NR_get_mempolicy: | 788 case __NR_get_mempolicy: |
751 case __NR_getcpu: | 789 case __NR_getcpu: |
752 case __NR_mbind: | 790 case __NR_mbind: |
791 #if defined(__i386__) || defined(__x86_64__) | |
753 case __NR_migrate_pages: | 792 case __NR_migrate_pages: |
793 #endif | |
754 case __NR_move_pages: | 794 case __NR_move_pages: |
755 case __NR_set_mempolicy: | 795 case __NR_set_mempolicy: |
756 return true; | 796 return true; |
757 default: | 797 default: |
758 return false; | 798 return false; |
759 } | 799 } |
760 } | 800 } |
761 | 801 |
762 bool IsMessageQueue(int sysno) { | 802 bool IsMessageQueue(int sysno) { |
763 switch (sysno) { | 803 switch (sysno) { |
764 case __NR_mq_getsetattr: | 804 case __NR_mq_getsetattr: |
765 case __NR_mq_notify: | 805 case __NR_mq_notify: |
766 case __NR_mq_open: | 806 case __NR_mq_open: |
767 case __NR_mq_timedreceive: | 807 case __NR_mq_timedreceive: |
768 case __NR_mq_timedsend: | 808 case __NR_mq_timedsend: |
769 case __NR_mq_unlink: | 809 case __NR_mq_unlink: |
770 return true; | 810 return true; |
771 default: | 811 default: |
772 return false; | 812 return false; |
773 } | 813 } |
774 } | 814 } |
775 | 815 |
776 bool IsGlobalProcessEnvironment(int sysno) { | 816 bool IsGlobalProcessEnvironment(int sysno) { |
777 switch (sysno) { | 817 switch (sysno) { |
778 case __NR_acct: // Privileged. | 818 case __NR_acct: // Privileged. |
819 #if defined(__i386__) || defined(__x86_64__) | |
779 case __NR_getrlimit: | 820 case __NR_getrlimit: |
780 #if defined(__i386__) | 821 #endif |
822 #if defined(__i386__) || defined(__arm__) | |
781 case __NR_ugetrlimit: | 823 case __NR_ugetrlimit: |
824 #elif defined(__i386__) | |
782 case __NR_ulimit: | 825 case __NR_ulimit: |
783 #endif | 826 #endif |
784 case __NR_getrusage: | 827 case __NR_getrusage: |
785 case __NR_personality: // Can change its personality as well. | 828 case __NR_personality: // Can change its personality as well. |
786 case __NR_prlimit64: // Like setrlimit / getrlimit. | 829 case __NR_prlimit64: // Like setrlimit / getrlimit. |
787 case __NR_setrlimit: | 830 case __NR_setrlimit: |
788 case __NR_times: | 831 case __NR_times: |
789 return true; | 832 return true; |
790 default: | 833 default: |
791 return false; | 834 return false; |
792 } | 835 } |
793 } | 836 } |
794 | 837 |
795 bool IsDebug(int sysno) { | 838 bool IsDebug(int sysno) { |
796 switch (sysno) { | 839 switch (sysno) { |
797 case __NR_ptrace: | 840 case __NR_ptrace: |
798 case __NR_process_vm_readv: | 841 case __NR_process_vm_readv: |
799 case __NR_process_vm_writev: | 842 case __NR_process_vm_writev: |
843 #if defined(__i386__) || defined(__x86_64__) | |
800 case __NR_kcmp: | 844 case __NR_kcmp: |
845 #endif | |
801 return true; | 846 return true; |
802 default: | 847 default: |
803 return false; | 848 return false; |
804 } | 849 } |
805 } | 850 } |
806 | 851 |
807 bool IsGlobalSystemStatus(int sysno) { | 852 bool IsGlobalSystemStatus(int sysno) { |
808 switch (sysno) { | 853 switch (sysno) { |
809 case __NR__sysctl: | 854 case __NR__sysctl: |
810 case __NR_sysfs: | 855 case __NR_sysfs: |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
947 case __NR_fanotify_mark: | 992 case __NR_fanotify_mark: |
948 return true; | 993 return true; |
949 default: | 994 default: |
950 return false; | 995 return false; |
951 } | 996 } |
952 } | 997 } |
953 | 998 |
954 bool IsTimer(int sysno) { | 999 bool IsTimer(int sysno) { |
955 switch (sysno) { | 1000 switch (sysno) { |
956 case __NR_getitimer: | 1001 case __NR_getitimer: |
1002 #if defined(__i386__) || defined(__x86_64__) | |
957 case __NR_alarm: | 1003 case __NR_alarm: |
1004 #endif | |
958 case __NR_setitimer: | 1005 case __NR_setitimer: |
959 return true; | 1006 return true; |
960 default: | 1007 default: |
961 return false; | 1008 return false; |
962 } | 1009 } |
963 } | 1010 } |
964 | 1011 |
965 bool IsAdvancedTimer(int sysno) { | 1012 bool IsAdvancedTimer(int sysno) { |
966 switch (sysno) { | 1013 switch (sysno) { |
967 case __NR_timer_create: | 1014 case __NR_timer_create: |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1001 // Various system calls that need to be researched. | 1048 // Various system calls that need to be researched. |
1002 // TODO(jln): classify this better. | 1049 // TODO(jln): classify this better. |
1003 bool IsMisc(int sysno) { | 1050 bool IsMisc(int sysno) { |
1004 switch (sysno) { | 1051 switch (sysno) { |
1005 case __NR_name_to_handle_at: | 1052 case __NR_name_to_handle_at: |
1006 case __NR_open_by_handle_at: | 1053 case __NR_open_by_handle_at: |
1007 case __NR_perf_event_open: | 1054 case __NR_perf_event_open: |
1008 case __NR_syncfs: | 1055 case __NR_syncfs: |
1009 case __NR_vhangup: | 1056 case __NR_vhangup: |
1010 // The system calls below are not implemented. | 1057 // The system calls below are not implemented. |
1058 #if defined(__i386__) || defined(__x86_64__) | |
1011 case __NR_afs_syscall: | 1059 case __NR_afs_syscall: |
1060 #endif | |
1012 #if defined(__i386__) | 1061 #if defined(__i386__) |
1013 case __NR_break: | 1062 case __NR_break: |
1014 #endif | 1063 #endif |
1064 #if defined(__i386__) || defined(__x86_64__) | |
1015 case __NR_getpmsg: | 1065 case __NR_getpmsg: |
1066 #endif | |
1016 #if defined(__i386__) | 1067 #if defined(__i386__) |
1017 case __NR_gtty: | 1068 case __NR_gtty: |
1018 case __NR_idle: | 1069 case __NR_idle: |
1019 case __NR_lock: | 1070 case __NR_lock: |
1020 case __NR_mpx: | 1071 case __NR_mpx: |
1021 case __NR_prof: | 1072 case __NR_prof: |
1022 case __NR_profil: | 1073 case __NR_profil: |
1023 #endif | 1074 #endif |
1075 #if defined(__i386__) || defined(__x86_64__) | |
1024 case __NR_putpmsg: | 1076 case __NR_putpmsg: |
1077 #endif | |
1025 #if defined(__x86_64__) | 1078 #if defined(__x86_64__) |
1026 case __NR_security: | 1079 case __NR_security: |
1027 #endif | 1080 #endif |
1028 #if defined(__i386__) | 1081 #if defined(__i386__) |
1029 case __NR_stty: | 1082 case __NR_stty: |
1030 #endif | 1083 #endif |
1031 #if defined(__x86_64__) | 1084 #if defined(__x86_64__) |
1032 case __NR_tuxcall: | 1085 case __NR_tuxcall: |
1033 #endif | 1086 #endif |
1034 case __NR_vserver: | 1087 case __NR_vserver: |
1035 return true; | 1088 return true; |
1036 default: | 1089 default: |
1037 return false; | 1090 return false; |
1038 } | 1091 } |
1039 } | 1092 } |
1040 | 1093 |
1094 #if defined(__arm__) | |
1095 bool IsArmPciConfig(int sysno) { | |
jln (very slow on Chromium)
2012/08/16 20:45:08
I really want to keep the property that the baseli
Jorge Lucangeli Obes
2012/08/16 21:32:08
I don't think these exist in x86/64. I don't under
| |
1096 switch (sysno) { | |
1097 case __NR_pciconfig_iobase: | |
1098 case __NR_pciconfig_read: | |
1099 case __NR_pciconfig_write: | |
1100 return true; | |
1101 default: | |
1102 return false; | |
1103 } | |
1104 } | |
1105 | |
1106 bool IsArmPrivate(int sysno) { | |
1107 switch (sysno) { | |
1108 case __ARM_NR_breakpoint: | |
1109 case __ARM_NR_cacheflush: | |
1110 case __ARM_NR_set_tls: | |
1111 case __ARM_NR_usr26: | |
1112 case __ARM_NR_usr32: | |
1113 return true; | |
1114 default: | |
1115 return false; | |
1116 } | |
1117 } | |
1118 #endif // defined(__arm__) | |
1119 | |
1041 // End of the system call sets section. | 1120 // End of the system call sets section. |
1042 | 1121 |
1043 bool IsBaselinePolicyAllowed_x86_64(int sysno) { | 1122 bool IsBaselinePolicyAllowed_x86_64(int sysno) { |
1044 if (IsAllowedAddressSpaceAccess(sysno) || | 1123 if (IsAllowedAddressSpaceAccess(sysno) || |
1045 IsAllowedBasicScheduler(sysno) || | 1124 IsAllowedBasicScheduler(sysno) || |
1046 IsAllowedEpoll(sysno) || | 1125 IsAllowedEpoll(sysno) || |
1047 IsAllowedFileSystemAccessViaFd(sysno) || | 1126 IsAllowedFileSystemAccessViaFd(sysno) || |
1048 IsAllowedGeneralIo(sysno) || | 1127 IsAllowedGeneralIo(sysno) || |
1049 IsAllowedGetOrModifySocket(sysno) || | 1128 IsAllowedGetOrModifySocket(sysno) || |
1050 IsAllowedGettime(sysno) || | 1129 IsAllowedGettime(sysno) || |
1051 IsAllowedPrctl(sysno) || | 1130 IsAllowedPrctl(sysno) || |
1052 IsAllowedProcessStartOrDeath(sysno) || | 1131 IsAllowedProcessStartOrDeath(sysno) || |
1053 IsAllowedSignalHandling(sysno) || | 1132 IsAllowedSignalHandling(sysno) || |
1054 IsFutex(sysno) || | 1133 IsFutex(sysno) || |
1055 IsGetSimpleId(sysno) || | 1134 IsGetSimpleId(sysno) || |
1056 IsKernelInteralApi(sysno) || | 1135 IsKernelInternalApi(sysno) || |
1057 IsKill(sysno) || | 1136 IsKill(sysno) || |
1058 IsOperationOnFd(sysno)) { | 1137 IsOperationOnFd(sysno)) { |
1059 return true; | 1138 return true; |
1060 } else { | 1139 } else { |
1061 return false; | 1140 return false; |
1062 } | 1141 } |
1063 } | 1142 } |
1064 | 1143 |
1065 // System calls that will trigger the crashing sigsys handler. | 1144 // System calls that will trigger the crashing sigsys handler. |
1066 bool IsBaselinePolicyWatched_x86_64(int sysno) { | 1145 bool IsBaselinePolicyWatched_x86_64(int sysno) { |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1338 // Process-specific policy. | 1417 // Process-specific policy. |
1339 ShouldEnableSeccompBpf(process_type) && | 1418 ShouldEnableSeccompBpf(process_type) && |
1340 SupportsSandbox()) { | 1419 SupportsSandbox()) { |
1341 return StartBpfSandbox(command_line, process_type); | 1420 return StartBpfSandbox(command_line, process_type); |
1342 } | 1421 } |
1343 #endif | 1422 #endif |
1344 return false; | 1423 return false; |
1345 } | 1424 } |
1346 | 1425 |
1347 } // namespace content | 1426 } // namespace content |
OLD | NEW |