OLD | NEW |
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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 // Only allow: PROT_READ | PROT_WRITE | PROT_EXEC. | 44 // Only allow: PROT_READ | PROT_WRITE | PROT_EXEC. |
45 SANDBOX_EXPORT ErrorCode RestrictMprotectFlags(SandboxBPF* sandbox); | 45 SANDBOX_EXPORT ErrorCode RestrictMprotectFlags(SandboxBPF* sandbox); |
46 | 46 |
47 // Restrict fcntl(2) cmd argument to: | 47 // Restrict fcntl(2) cmd argument to: |
48 // We allow F_GETFL, F_SETFL, F_GETFD, F_SETFD, F_DUPFD, F_DUPFD_CLOEXEC, | 48 // We allow F_GETFL, F_SETFL, F_GETFD, F_SETFD, F_DUPFD, F_DUPFD_CLOEXEC, |
49 // F_SETLK, F_SETLKW and F_GETLK. | 49 // F_SETLK, F_SETLKW and F_GETLK. |
50 // Also, in F_SETFL, restrict the allowed flags to: O_ACCMODE | O_APPEND | | 50 // Also, in F_SETFL, restrict the allowed flags to: O_ACCMODE | O_APPEND | |
51 // O_NONBLOCK | O_SYNC | O_LARGEFILE | O_CLOEXEC | O_NOATIME. | 51 // O_NONBLOCK | O_SYNC | O_LARGEFILE | O_CLOEXEC | O_NOATIME. |
52 SANDBOX_EXPORT ErrorCode RestrictFcntlCommands(SandboxBPF* sandbox); | 52 SANDBOX_EXPORT ErrorCode RestrictFcntlCommands(SandboxBPF* sandbox); |
53 | 53 |
54 #if defined(__i386__) | 54 #if defined(__i386__) || defined(__mips__) |
55 // Restrict socketcall(2) to only allow socketpair(2), send(2), recv(2), | 55 // Restrict socketcall(2) to only allow socketpair(2), send(2), recv(2), |
56 // sendto(2), recvfrom(2), shutdown(2), sendmsg(2) and recvmsg(2). | 56 // sendto(2), recvfrom(2), shutdown(2), sendmsg(2) and recvmsg(2). |
57 SANDBOX_EXPORT ErrorCode RestrictSocketcallCommand(SandboxBPF* sandbox); | 57 SANDBOX_EXPORT ErrorCode RestrictSocketcallCommand(SandboxBPF* sandbox); |
58 #endif | 58 #endif |
59 | 59 |
60 // Restrict |sysno| (which must be kill, tkill or tgkill) by allowing tgkill or | 60 // Restrict |sysno| (which must be kill, tkill or tgkill) by allowing tgkill or |
61 // kill iff the first parameter is |target_pid|, crashing otherwise or if | 61 // kill iff the first parameter is |target_pid|, crashing otherwise or if |
62 // |sysno| is tkill. | 62 // |sysno| is tkill. |
63 ErrorCode RestrictKillTarget(pid_t target_pid, SandboxBPF* sandbox, int sysno); | 63 ErrorCode RestrictKillTarget(pid_t target_pid, SandboxBPF* sandbox, int sysno); |
64 | 64 |
65 // Crash if FUTEX_CMP_REQUEUE_PI is used in the second argument of futex(2). | 65 // Crash if FUTEX_CMP_REQUEUE_PI is used in the second argument of futex(2). |
66 ErrorCode RestrictFutex(SandboxBPF* sandbox); | 66 ErrorCode RestrictFutex(SandboxBPF* sandbox); |
67 | 67 |
68 } // namespace sandbox. | 68 } // namespace sandbox. |
69 | 69 |
70 #endif // SANDBOX_LINUX_SECCOMP_BPF_HELPERS_SYSCALL_PARAMETERS_RESTRICTIONS_H_ | 70 #endif // SANDBOX_LINUX_SECCOMP_BPF_HELPERS_SYSCALL_PARAMETERS_RESTRICTIONS_H_ |
OLD | NEW |