1 /* $NetBSD: seccomp.h,v 1.1.1.3 2014/12/10 03:34:25 christos Exp $ */ 2 3 /* 4 * Copyright (C) 2014 Internet Systems Consortium, Inc. ("ISC") 5 * 6 * Permission to use, copy, modify, and/or distribute this software for any 7 * purpose with or without fee is hereby granted, provided that the above 8 * copyright notice and this permission notice appear in all copies. 9 * 10 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH 11 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 12 * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, 13 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 14 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 15 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 16 * PERFORMANCE OF THIS SOFTWARE. 17 */ 18 19 #ifndef NAMED_SECCOMP_H 20 #define NAMED_SECCOMP_H 1 21 22 /*! \file */ 23 24 #ifdef HAVE_LIBSECCOMP 25 #include <sys/types.h> 26 #include <sys/resource.h> 27 #include <unistd.h> 28 #include <seccomp.h> 29 #include <isc/platform.h> 30 31 /*% 32 * For each architecture, the scmp_syscalls and 33 * scmp_syscall_names arrays MUST be kept in sync. 34 */ 35 #ifdef __x86_64__ 36 int scmp_syscalls[] = { 37 SCMP_SYS(access), 38 SCMP_SYS(open), 39 SCMP_SYS(clock_gettime), 40 SCMP_SYS(time), 41 SCMP_SYS(read), 42 SCMP_SYS(write), 43 SCMP_SYS(close), 44 SCMP_SYS(brk), 45 SCMP_SYS(poll), 46 SCMP_SYS(select), 47 SCMP_SYS(madvise), 48 SCMP_SYS(mmap), 49 SCMP_SYS(munmap), 50 SCMP_SYS(exit_group), 51 SCMP_SYS(rt_sigprocmask), 52 SCMP_SYS(rt_sigaction), 53 SCMP_SYS(fsync), 54 SCMP_SYS(rt_sigreturn), 55 SCMP_SYS(setsid), 56 SCMP_SYS(chdir), 57 SCMP_SYS(futex), 58 SCMP_SYS(stat), 59 SCMP_SYS(rt_sigsuspend), 60 SCMP_SYS(fstat), 61 SCMP_SYS(epoll_ctl), 62 SCMP_SYS(gettimeofday), 63 SCMP_SYS(unlink), 64 SCMP_SYS(socket), 65 SCMP_SYS(sendto), 66 #ifndef ISC_PLATFORM_USETHREADS 67 SCMP_SYS(bind), 68 SCMP_SYS(accept), 69 SCMP_SYS(connect), 70 SCMP_SYS(listen), 71 SCMP_SYS(fcntl), 72 SCMP_SYS(sendmsg), 73 SCMP_SYS(recvmsg), 74 SCMP_SYS(uname), 75 SCMP_SYS(setrlimit), 76 SCMP_SYS(getrlimit), 77 SCMP_SYS(setsockopt), 78 SCMP_SYS(getsockopt), 79 SCMP_SYS(getsockname), 80 SCMP_SYS(lstat), 81 SCMP_SYS(lseek), 82 SCMP_SYS(getgid), 83 SCMP_SYS(getegid), 84 SCMP_SYS(getuid), 85 SCMP_SYS(geteuid), 86 SCMP_SYS(setresgid), 87 SCMP_SYS(setresuid), 88 SCMP_SYS(setgid), 89 SCMP_SYS(setuid), 90 SCMP_SYS(prctl), 91 SCMP_SYS(epoll_wait), 92 SCMP_SYS(openat), 93 SCMP_SYS(getdents), 94 SCMP_SYS(rename), 95 SCMP_SYS(utimes), 96 SCMP_SYS(dup), 97 #endif 98 }; 99 const char *scmp_syscall_names[] = { 100 "access", 101 "open", 102 "clock_gettime", 103 "time", 104 "read", 105 "write", 106 "close", 107 "brk", 108 "poll", 109 "select", 110 "madvise", 111 "mmap", 112 "munmap", 113 "exit_group", 114 "rt_sigprocmask", 115 "rt_sigaction", 116 "fsync", 117 "rt_sigreturn", 118 "setsid", 119 "chdir", 120 "futex", 121 "stat", 122 "rt_sigsuspend", 123 "fstat", 124 "epoll_ctl", 125 "gettimeofday", 126 "unlink", 127 "socket", 128 "sendto", 129 #ifndef ISC_PLATFORM_USETHREADS 130 "bind", 131 "accept", 132 "connect", 133 "listen", 134 "fcntl", 135 "sendmsg", 136 "recvmsg", 137 "uname", 138 "setrlimit", 139 "getrlimit", 140 "setsockopt", 141 "getsockopt", 142 "getsockname", 143 "lstat", 144 "lseek", 145 "getgid", 146 "getegid", 147 "getuid", 148 "geteuid", 149 "setresgid", 150 "setresuid", 151 "setgid", 152 "setuid", 153 "prctl", 154 "epoll_wait", 155 "openat", 156 "getdents", 157 "rename", 158 "utimes", 159 "dup", 160 #endif 161 }; 162 #endif /* __x86_64__ */ 163 #ifdef __i386__ 164 int scmp_syscalls[] = { 165 SCMP_SYS(access), 166 SCMP_SYS(open), 167 SCMP_SYS(clock_gettime), 168 SCMP_SYS(time), 169 SCMP_SYS(read), 170 SCMP_SYS(write), 171 SCMP_SYS(close), 172 SCMP_SYS(brk), 173 SCMP_SYS(poll), 174 SCMP_SYS(_newselect), 175 SCMP_SYS(select), 176 SCMP_SYS(madvise), 177 SCMP_SYS(mmap2), 178 SCMP_SYS(mmap), 179 SCMP_SYS(munmap), 180 SCMP_SYS(exit_group), 181 SCMP_SYS(rt_sigprocmask), 182 SCMP_SYS(sigprocmask), 183 SCMP_SYS(rt_sigaction), 184 SCMP_SYS(socketcall), 185 SCMP_SYS(fsync), 186 SCMP_SYS(sigreturn), 187 SCMP_SYS(setsid), 188 SCMP_SYS(chdir), 189 SCMP_SYS(futex), 190 SCMP_SYS(stat64), 191 SCMP_SYS(rt_sigsuspend), 192 SCMP_SYS(fstat64), 193 SCMP_SYS(epoll_ctl), 194 SCMP_SYS(gettimeofday), 195 SCMP_SYS(unlink), 196 #ifndef ISC_PLATFORM_USETHREADS 197 SCMP_SYS(fcntl64), 198 #endif 199 }; 200 const char *scmp_syscall_names[] = { 201 "access", 202 "open", 203 "clock_gettime", 204 "time", 205 "read", 206 "write", 207 "close", 208 "brk", 209 "poll", 210 "_newselect", 211 "select", 212 "madvise", 213 "mmap2", 214 "mmap", 215 "munmap", 216 "exit_group", 217 "rt_sigprocmask", 218 "sigprocmask", 219 "rt_sigaction", 220 "socketcall", 221 "fsync", 222 "sigreturn", 223 "setsid", 224 "chdir", 225 "futex", 226 "stat64", 227 "rt_sigsuspend", 228 "fstat64", 229 "epoll_ctl", 230 "gettimeofday", 231 "unlink", 232 #ifndef ISC_PLATFORM_USETHREADS 233 "fcntl64", 234 #endif 235 }; 236 #endif /* __i386__ */ 237 #endif /* HAVE_LIBSECCOMP */ 238 239 #endif /* NAMED_SECCOMP_H */ 240