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

Side by Side Diff: sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc

Issue 566083002: Linux sandbox: restrict clock_gettime() and clock_getres() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 | « sandbox/linux/seccomp-bpf-helpers/baseline_policy_unittest.cc ('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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/seccomp-bpf-helpers/syscall_sets.h" 5 #include "sandbox/linux/seccomp-bpf-helpers/syscall_sets.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 #include "sandbox/linux/services/linux_syscalls.h" 8 #include "sandbox/linux/services/linux_syscalls.h"
9 9
10 namespace sandbox { 10 namespace sandbox {
11 11
12 // The functions below cover all existing i386, x86_64, and ARM system calls; 12 // The functions below cover all existing i386, x86_64, and ARM system calls;
13 // excluding syscalls made obsolete in ARM EABI. 13 // excluding syscalls made obsolete in ARM EABI.
14 // The implicitly defined sets form a partition of the sets of 14 // The implicitly defined sets form a partition of the sets of
15 // system calls. 15 // system calls.
16 16
17 bool SyscallSets::IsKill(int sysno) { 17 bool SyscallSets::IsKill(int sysno) {
18 switch (sysno) { 18 switch (sysno) {
19 case __NR_kill: 19 case __NR_kill:
20 case __NR_tgkill: 20 case __NR_tgkill:
21 case __NR_tkill: // Deprecated. 21 case __NR_tkill: // Deprecated.
22 return true; 22 return true;
23 default: 23 default:
24 return false; 24 return false;
25 } 25 }
26 } 26 }
27 27
28 bool SyscallSets::IsAllowedGettime(int sysno) { 28 bool SyscallSets::IsAllowedGettime(int sysno) {
29 switch (sysno) { 29 switch (sysno) {
30 case __NR_clock_gettime:
31 case __NR_gettimeofday: 30 case __NR_gettimeofday:
32 #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) 31 #if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
33 case __NR_time: 32 case __NR_time:
34 #endif 33 #endif
35 return true; 34 return true;
36 case __NR_adjtimex: // Privileged. 35 case __NR_adjtimex: // Privileged.
37 case __NR_clock_adjtime: // Privileged. 36 case __NR_clock_adjtime: // Privileged.
38 case __NR_clock_getres: // Could be allowed. 37 case __NR_clock_getres: // Could be allowed.
38 case __NR_clock_gettime:
39 case __NR_clock_nanosleep: // Could be allowed. 39 case __NR_clock_nanosleep: // Could be allowed.
40 case __NR_clock_settime: // Privileged. 40 case __NR_clock_settime: // Privileged.
41 #if defined(__i386__) || defined(__mips__) 41 #if defined(__i386__) || defined(__mips__)
42 case __NR_ftime: // Obsolete. 42 case __NR_ftime: // Obsolete.
43 #endif 43 #endif
44 case __NR_settimeofday: // Privileged. 44 case __NR_settimeofday: // Privileged.
45 #if defined(__i386__) || defined(__mips__) 45 #if defined(__i386__) || defined(__mips__)
46 case __NR_stime: 46 case __NR_stime:
47 #endif 47 #endif
48 default: 48 default:
(...skipping 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after
1052 switch (sysno) { 1052 switch (sysno) {
1053 case __NR_sysmips: 1053 case __NR_sysmips:
1054 case __NR_unused150: 1054 case __NR_unused150:
1055 return true; 1055 return true;
1056 default: 1056 default:
1057 return false; 1057 return false;
1058 } 1058 }
1059 } 1059 }
1060 #endif // defined(__mips__) 1060 #endif // defined(__mips__)
1061 } // namespace sandbox. 1061 } // namespace sandbox.
OLDNEW
« no previous file with comments | « sandbox/linux/seccomp-bpf-helpers/baseline_policy_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698