seccomp.h 4.1 KB
Newer Older
1
/*
2
 * Copyright (C) 2014, 2016, 2017  Internet Systems Consortium, Inc. ("ISC")
3
 *
4 5 6
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 8 9 10 11 12 13 14 15 16 17 18
 */

#ifndef NAMED_SECCOMP_H
#define NAMED_SECCOMP_H 1

/*! \file */

#ifdef HAVE_LIBSECCOMP
#include <sys/types.h>
#include <sys/resource.h>
#include <unistd.h>
#include <seccomp.h>
19
#include <isc/platform.h>
20 21 22 23 24 25 26 27 28

/*%
 * For each architecture, the scmp_syscalls and
 * scmp_syscall_names arrays MUST be kept in sync.
 */
#ifdef __x86_64__
int scmp_syscalls[] = {
	SCMP_SYS(access),
	SCMP_SYS(open),
29 30
	SCMP_SYS(openat),
	SCMP_SYS(lseek),
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
	SCMP_SYS(clock_gettime),
	SCMP_SYS(time),
	SCMP_SYS(read),
	SCMP_SYS(write),
	SCMP_SYS(close),
	SCMP_SYS(brk),
	SCMP_SYS(poll),
	SCMP_SYS(select),
	SCMP_SYS(madvise),
	SCMP_SYS(mmap),
	SCMP_SYS(munmap),
	SCMP_SYS(exit_group),
	SCMP_SYS(rt_sigprocmask),
	SCMP_SYS(rt_sigaction),
	SCMP_SYS(fsync),
	SCMP_SYS(rt_sigreturn),
	SCMP_SYS(setsid),
	SCMP_SYS(chdir),
	SCMP_SYS(futex),
	SCMP_SYS(stat),
	SCMP_SYS(rt_sigsuspend),
	SCMP_SYS(fstat),
	SCMP_SYS(epoll_ctl),
	SCMP_SYS(gettimeofday),
55 56 57 58
	SCMP_SYS(getpid),
#ifdef HAVE_GETRANDOM
	SCMP_SYS(getrandom),
#endif
59
	SCMP_SYS(rename),
60 61
	SCMP_SYS(unlink),
	SCMP_SYS(socket),
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
	SCMP_SYS(sendto),
#ifndef ISC_PLATFORM_USETHREADS
	SCMP_SYS(bind),
	SCMP_SYS(accept),
	SCMP_SYS(connect),
	SCMP_SYS(listen),
	SCMP_SYS(fcntl),
	SCMP_SYS(sendmsg),
	SCMP_SYS(recvmsg),
	SCMP_SYS(uname),
	SCMP_SYS(setrlimit),
	SCMP_SYS(getrlimit),
	SCMP_SYS(setsockopt),
	SCMP_SYS(getsockopt),
	SCMP_SYS(getsockname),
	SCMP_SYS(lstat),
	SCMP_SYS(getgid),
	SCMP_SYS(getegid),
	SCMP_SYS(getuid),
	SCMP_SYS(geteuid),
	SCMP_SYS(setresgid),
	SCMP_SYS(setresuid),
	SCMP_SYS(setgid),
	SCMP_SYS(setuid),
	SCMP_SYS(prctl),
	SCMP_SYS(epoll_wait),
	SCMP_SYS(getdents),
	SCMP_SYS(utimes),
90
	SCMP_SYS(dup),
91
#endif
92 93
};
const char *scmp_syscall_names[] = {
94 95
	"access",
	"open",
96 97
	"openat",
	"lseek",
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121
	"clock_gettime",
	"time",
	"read",
	"write",
	"close",
	"brk",
	"poll",
	"select",
	"madvise",
	"mmap",
	"munmap",
	"exit_group",
	"rt_sigprocmask",
	"rt_sigaction",
	"fsync",
	"rt_sigreturn",
	"setsid",
	"chdir",
	"futex",
	"stat",
	"rt_sigsuspend",
	"fstat",
	"epoll_ctl",
	"gettimeofday",
122 123 124 125
	"getpid",
#ifdef HAVE_GETRANDOM
	"getrandom",
#endif
126
	"rename",
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156
	"unlink",
	"socket",
	"sendto",
#ifndef ISC_PLATFORM_USETHREADS
	"bind",
	"accept",
	"connect",
	"listen",
	"fcntl",
	"sendmsg",
	"recvmsg",
	"uname",
	"setrlimit",
	"getrlimit",
	"setsockopt",
	"getsockopt",
	"getsockname",
	"lstat",
	"getgid",
	"getegid",
	"getuid",
	"geteuid",
	"setresgid",
	"setresuid",
	"setgid",
	"setuid",
	"prctl",
	"epoll_wait",
	"getdents",
	"utimes",
157
	"dup",
158
#endif
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191
};
#endif /* __x86_64__ */
#ifdef __i386__
int scmp_syscalls[] = {
	SCMP_SYS(access),
	SCMP_SYS(open),
	SCMP_SYS(clock_gettime),
	SCMP_SYS(time),
	SCMP_SYS(read),
	SCMP_SYS(write),
	SCMP_SYS(close),
	SCMP_SYS(brk),
	SCMP_SYS(poll),
	SCMP_SYS(_newselect),
	SCMP_SYS(select),
	SCMP_SYS(madvise),
	SCMP_SYS(mmap2),
	SCMP_SYS(mmap),
	SCMP_SYS(munmap),
	SCMP_SYS(exit_group),
	SCMP_SYS(rt_sigprocmask),
	SCMP_SYS(sigprocmask),
	SCMP_SYS(rt_sigaction),
	SCMP_SYS(socketcall),
	SCMP_SYS(fsync),
	SCMP_SYS(sigreturn),
	SCMP_SYS(setsid),
	SCMP_SYS(chdir),
	SCMP_SYS(futex),
	SCMP_SYS(stat64),
	SCMP_SYS(rt_sigsuspend),
	SCMP_SYS(fstat64),
	SCMP_SYS(epoll_ctl),
192
	SCMP_SYS(gettimeofday),
193 194 195 196
	SCMP_SYS(getpid),
#ifdef HAVE_GETRANDOM
	SCMP_SYS(getrandom),
#endif
197 198 199 200
	SCMP_SYS(unlink),
#ifndef ISC_PLATFORM_USETHREADS
	SCMP_SYS(fcntl64),
#endif
201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231
};
const char *scmp_syscall_names[] = {
	"access",
	"open",
	"clock_gettime",
	"time",
	"read",
	"write",
	"close",
	"brk",
	"poll",
	"_newselect",
	"select",
	"madvise",
	"mmap2",
	"mmap",
	"munmap",
	"exit_group",
	"rt_sigprocmask",
	"sigprocmask",
	"rt_sigaction",
	"socketcall",
	"fsync",
	"sigreturn",
	"setsid",
	"chdir",
	"futex",
	"stat64",
	"rt_sigsuspend",
	"fstat64",
	"epoll_ctl",
232
	"gettimeofday",
233 234 235 236
	"getpid",
#ifdef HAVE_GETRANDOM
	"getrandom",
#endif
237 238
	"unlink",
#ifndef ISC_PLATFORM_USETHREADS
Tinderbox User's avatar
Tinderbox User committed
239
	"fcntl64",
240
#endif
241 242 243 244 245
};
#endif /* __i386__ */
#endif /* HAVE_LIBSECCOMP */

#endif /* NAMED_SECCOMP_H */