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

Side by Side Diff: sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h

Issue 1128733002: Update from https://crrev.com/328418 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 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
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 #ifndef SANDBOX_LINUX_SECCOMP_BPF_HELPERS_SYSCALL_PARAMETERS_RESTRICTIONS_H_ 5 #ifndef SANDBOX_LINUX_SECCOMP_BPF_HELPERS_SYSCALL_PARAMETERS_RESTRICTIONS_H_
6 #define SANDBOX_LINUX_SECCOMP_BPF_HELPERS_SYSCALL_PARAMETERS_RESTRICTIONS_H_ 6 #define SANDBOX_LINUX_SECCOMP_BPF_HELPERS_SYSCALL_PARAMETERS_RESTRICTIONS_H_
7 7
8 #include <unistd.h> 8 #include <unistd.h>
9 9
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 SANDBOX_EXPORT bpf_dsl::ResultExpr RestrictKillTarget(pid_t target_pid, 60 SANDBOX_EXPORT bpf_dsl::ResultExpr RestrictKillTarget(pid_t target_pid,
61 int sysno); 61 int sysno);
62 62
63 // Crash if FUTEX_CMP_REQUEUE_PI is used in the second argument of futex(2). 63 // Crash if FUTEX_CMP_REQUEUE_PI is used in the second argument of futex(2).
64 SANDBOX_EXPORT bpf_dsl::ResultExpr RestrictFutex(); 64 SANDBOX_EXPORT bpf_dsl::ResultExpr RestrictFutex();
65 65
66 // Crash if |which| is not PRIO_PROCESS. EPERM if |who| is not 0, neither 66 // Crash if |which| is not PRIO_PROCESS. EPERM if |who| is not 0, neither
67 // |target_pid| while calling setpriority(2) / getpriority(2). 67 // |target_pid| while calling setpriority(2) / getpriority(2).
68 SANDBOX_EXPORT bpf_dsl::ResultExpr RestrictGetSetpriority(pid_t target_pid); 68 SANDBOX_EXPORT bpf_dsl::ResultExpr RestrictGetSetpriority(pid_t target_pid);
69 69
70 // Restrict |clk_id| for clock_getres(), clock_gettime() and clock_settime().
71 // We allow accessing only CLOCK_MONOTONIC, CLOCK_PROCESS_CPUTIME_ID,
72 // CLOCK_REALTIME, and CLOCK_THREAD_CPUTIME_ID. In particular, this disallows
73 // access to arbitrary per-{process,thread} CPU-time clock IDs (such as those
74 // returned by {clock,pthread}_getcpuclockid), which can leak information
75 // about the state of the host OS.
76 // On Chrome OS, base::TimeTicks::kClockSystemTrace is also allowed.
77 SANDBOX_EXPORT bpf_dsl::ResultExpr RestrictClockID();
78
79 // Restricts |pid| for sched_* syscalls which take a pid as the first argument. 70 // Restricts |pid| for sched_* syscalls which take a pid as the first argument.
80 // We only allow calling these syscalls if the pid argument is equal to the pid 71 // We only allow calling these syscalls if the pid argument is equal to the pid
81 // of the sandboxed process or 0 (indicating the current thread). The following 72 // of the sandboxed process or 0 (indicating the current thread). The following
82 // syscalls are supported: 73 // syscalls are supported:
83 // 74 //
84 // sched_getaffinity(), sched_getattr(), sched_getparam(), sched_getscheduler(), 75 // sched_getaffinity(), sched_getattr(), sched_getparam(), sched_getscheduler(),
85 // sched_rr_get_interval(), sched_setaffinity(), sched_setattr(), 76 // sched_rr_get_interval(), sched_setaffinity(), sched_setattr(),
86 // sched_setparam(), sched_setscheduler() 77 // sched_setparam(), sched_setscheduler()
87 SANDBOX_EXPORT bpf_dsl::ResultExpr RestrictSchedTarget(pid_t target_pid, 78 SANDBOX_EXPORT bpf_dsl::ResultExpr RestrictSchedTarget(pid_t target_pid,
88 int sysno); 79 int sysno);
89 80
90 // Restricts the |pid| argument of prlimit64 to 0 (meaning the calling process) 81 // Restricts the |pid| argument of prlimit64 to 0 (meaning the calling process)
91 // or target_pid. 82 // or target_pid.
92 SANDBOX_EXPORT bpf_dsl::ResultExpr RestrictPrlimit64(pid_t target_pid); 83 SANDBOX_EXPORT bpf_dsl::ResultExpr RestrictPrlimit64(pid_t target_pid);
93 84
94 // Restricts the |who| argument of getrusage to RUSAGE_SELF (meaning the calling 85 // Restricts the |who| argument of getrusage to RUSAGE_SELF (meaning the calling
95 // process). 86 // process).
96 SANDBOX_EXPORT bpf_dsl::ResultExpr RestrictGetrusage(); 87 SANDBOX_EXPORT bpf_dsl::ResultExpr RestrictGetrusage();
97 88
89 // Restrict |clk_id| for clock_getres(), clock_gettime() and clock_settime().
90 // We allow accessing only CLOCK_MONOTONIC, CLOCK_PROCESS_CPUTIME_ID,
91 // CLOCK_REALTIME, and CLOCK_THREAD_CPUTIME_ID. In particular, this disallows
92 // access to arbitrary per-{process,thread} CPU-time clock IDs (such as those
93 // returned by {clock,pthread}_getcpuclockid), which can leak information
94 // about the state of the host OS.
95 // On Chrome OS, base::TimeTicks::kClockSystemTrace is also allowed.
96 SANDBOX_EXPORT bpf_dsl::ResultExpr RestrictClockID();
97
98 } // namespace sandbox. 98 } // namespace sandbox.
99 99
100 #endif // SANDBOX_LINUX_SECCOMP_BPF_HELPERS_SYSCALL_PARAMETERS_RESTRICTIONS_H_ 100 #endif // SANDBOX_LINUX_SECCOMP_BPF_HELPERS_SYSCALL_PARAMETERS_RESTRICTIONS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698