mkseccomp.sample 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444
  1. /* This sample file is an example for mkseccomp.pl to produce a seccomp file
  2. * which restricts syscalls that are only useful for an admin but allows the
  3. * vast majority of normal userspace programs to run normally.
  4. *
  5. * The format of this file is one line per syscall. This is then processed
  6. * and passed to 'cpp' to convert the names to numbers using whatever is
  7. * correct for your platform. As such C-style comments are permitted. Note
  8. * this also means that C preprocessor macros are also allowed. So it is
  9. * possible to create groups surrounded by #ifdef/#endif and control their
  10. * inclusion via #define (not #include).
  11. *
  12. * Syscalls that don't exist on your architecture are silently filtered out.
  13. * Syscalls marked with (*) are required for a container to spawn a bash
  14. * shell successfully (not necessarily full featured). Listing the same
  15. * syscall multiple times is no problem.
  16. *
  17. * If you want to make a list specifically for one application the easiest
  18. * way is to run the application under strace, like so:
  19. *
  20. * $ strace -f -q -c -o strace.out application args...
  21. *
  22. * Once you have a reasonable sample of the execution of the program, exit
  23. * it. The file strace.out will have a summary of the syscalls used. Copy
  24. * that list into this file, comment out everything else except the starred
  25. * syscalls (which you need for the container to start) and you're done.
  26. *
  27. * To get the list of syscalls from the strace output this works well for
  28. * me
  29. *
  30. * $ cut -c52 < strace.out
  31. *
  32. * This sample list was compiled as a combination of all the syscalls
  33. * available on i386 and amd64 on Ubuntu Precise, as such it may not contain
  34. * everything and not everything may be relevent for your system. This
  35. * shouldn't be a problem.
  36. */
  37. // Filesystem/File descriptor related
  38. access // (*)
  39. chdir // (*)
  40. chmod
  41. chown
  42. chown32
  43. close // (*)
  44. creat
  45. dup // (*)
  46. dup2 // (*)
  47. dup3
  48. epoll_create
  49. epoll_create1
  50. epoll_ctl
  51. epoll_ctl_old
  52. epoll_pwait
  53. epoll_wait
  54. epoll_wait_old
  55. eventfd
  56. eventfd2
  57. faccessat // (*)
  58. fadvise64
  59. fadvise64_64
  60. fallocate
  61. fanotify_init
  62. fanotify_mark
  63. ioctl // (*)
  64. fchdir
  65. fchmod
  66. fchmodat
  67. fchown
  68. fchown32
  69. fchownat
  70. fcntl // (*)
  71. fcntl64
  72. fdatasync
  73. fgetxattr
  74. flistxattr
  75. flock
  76. fremovexattr
  77. fsetxattr
  78. fstat // (*)
  79. fstat64
  80. fstatat64
  81. fstatfs
  82. fstatfs64
  83. fsync
  84. ftruncate
  85. ftruncate64
  86. getcwd // (*)
  87. getdents // (*)
  88. getdents64
  89. getxattr
  90. inotify_add_watch
  91. inotify_init
  92. inotify_init1
  93. inotify_rm_watch
  94. io_cancel
  95. io_destroy
  96. io_getevents
  97. io_setup
  98. io_submit
  99. lchown
  100. lchown32
  101. lgetxattr
  102. link
  103. linkat
  104. listxattr
  105. llistxattr
  106. llseek
  107. _llseek
  108. lremovexattr
  109. lseek // (*)
  110. lsetxattr
  111. lstat
  112. lstat64
  113. mkdir
  114. mkdirat
  115. mknod
  116. mknodat
  117. newfstatat
  118. _newselect
  119. oldfstat
  120. oldlstat
  121. oldolduname
  122. oldstat
  123. olduname
  124. oldwait4
  125. open // (*)
  126. openat // (*)
  127. pipe // (*)
  128. pipe2
  129. poll
  130. ppoll
  131. pread64
  132. preadv
  133. futimesat
  134. pselect6
  135. pwrite64
  136. pwritev
  137. read // (*)
  138. readahead
  139. readdir
  140. readlink
  141. readlinkat
  142. readv
  143. removexattr
  144. rename
  145. renameat
  146. rmdir
  147. select
  148. sendfile
  149. sendfile64
  150. setxattr
  151. splice
  152. stat // (*)
  153. stat64
  154. statfs // (*)
  155. statfs64
  156. symlink
  157. symlinkat
  158. sync
  159. sync_file_range
  160. sync_file_range2
  161. syncfs
  162. tee
  163. truncate
  164. truncate64
  165. umask
  166. unlink
  167. unlinkat
  168. ustat
  169. utime
  170. utimensat
  171. utimes
  172. write // (*)
  173. writev
  174. // Network related
  175. accept
  176. accept4
  177. bind // (*)
  178. connect // (*)
  179. getpeername
  180. getsockname // (*)
  181. getsockopt
  182. listen
  183. recv
  184. recvfrom // (*)
  185. recvmmsg
  186. recvmsg
  187. send
  188. sendmmsg
  189. sendmsg
  190. sendto // (*)
  191. setsockopt
  192. shutdown
  193. socket // (*)
  194. socketcall
  195. socketpair
  196. // Signal related
  197. pause
  198. rt_sigaction // (*)
  199. rt_sigpending
  200. rt_sigprocmask // (*)
  201. rt_sigqueueinfo
  202. rt_sigreturn // (*)
  203. rt_sigsuspend
  204. rt_sigtimedwait
  205. rt_tgsigqueueinfo
  206. sigaction
  207. sigaltstack // (*)
  208. signal
  209. signalfd
  210. signalfd4
  211. sigpending
  212. sigprocmask
  213. sigreturn
  214. sigsuspend
  215. // Other needed POSIX
  216. alarm
  217. brk // (*)
  218. clock_adjtime
  219. clock_getres
  220. clock_gettime
  221. clock_nanosleep
  222. //clock_settime
  223. gettimeofday
  224. nanosleep
  225. nice
  226. sysinfo
  227. syslog
  228. time
  229. timer_create
  230. timer_delete
  231. timerfd_create
  232. timerfd_gettime
  233. timerfd_settime
  234. timer_getoverrun
  235. timer_gettime
  236. timer_settime
  237. times
  238. uname // (*)
  239. // Memory control
  240. madvise
  241. mbind
  242. mincore
  243. mlock
  244. mlockall
  245. mmap // (*)
  246. mmap2
  247. mprotect // (*)
  248. mremap
  249. msync
  250. munlock
  251. munlockall
  252. munmap // (*)
  253. remap_file_pages
  254. set_mempolicy
  255. vmsplice
  256. // Process control
  257. capget
  258. //capset
  259. clone // (*)
  260. execve // (*)
  261. exit // (*)
  262. exit_group // (*)
  263. fork
  264. getcpu
  265. getpgid
  266. getpgrp // (*)
  267. getpid // (*)
  268. getppid // (*)
  269. getpriority
  270. getresgid
  271. getresgid32
  272. getresuid
  273. getresuid32
  274. getrlimit // (*)
  275. getrusage
  276. getsid
  277. getuid // (*)
  278. getuid32
  279. getegid // (*)
  280. getegid32
  281. geteuid // (*)
  282. geteuid32
  283. getgid // (*)
  284. getgid32
  285. getgroups
  286. getgroups32
  287. getitimer
  288. get_mempolicy
  289. kill
  290. //personality
  291. prctl
  292. prlimit64
  293. sched_getaffinity
  294. sched_getparam
  295. sched_get_priority_max
  296. sched_get_priority_min
  297. sched_getscheduler
  298. sched_rr_get_interval
  299. //sched_setaffinity
  300. //sched_setparam
  301. //sched_setscheduler
  302. sched_yield
  303. setfsgid
  304. setfsgid32
  305. setfsuid
  306. setfsuid32
  307. setgid
  308. setgid32
  309. setgroups
  310. setgroups32
  311. setitimer
  312. setpgid // (*)
  313. setpriority
  314. setregid
  315. setregid32
  316. setresgid
  317. setresgid32
  318. setresuid
  319. setresuid32
  320. setreuid
  321. setreuid32
  322. setrlimit
  323. setsid
  324. setuid
  325. setuid32
  326. ugetrlimit
  327. vfork
  328. wait4 // (*)
  329. waitid
  330. waitpid
  331. // IPC
  332. ipc
  333. mq_getsetattr
  334. mq_notify
  335. mq_open
  336. mq_timedreceive
  337. mq_timedsend
  338. mq_unlink
  339. msgctl
  340. msgget
  341. msgrcv
  342. msgsnd
  343. semctl
  344. semget
  345. semop
  346. semtimedop
  347. shmat
  348. shmctl
  349. shmdt
  350. shmget
  351. // Linux specific, mostly needed for thread-related stuff
  352. arch_prctl // (*)
  353. get_robust_list
  354. get_thread_area
  355. gettid
  356. futex // (*)
  357. restart_syscall // (*)
  358. set_robust_list // (*)
  359. set_thread_area
  360. set_tid_address // (*)
  361. tgkill
  362. tkill
  363. // Admin syscalls, these are blocked
  364. //acct
  365. //adjtimex
  366. //bdflush
  367. //chroot
  368. //create_module
  369. //delete_module
  370. //get_kernel_syms // Obsolete
  371. //idle // Obsolete
  372. //init_module
  373. //ioperm
  374. //iopl
  375. //ioprio_get
  376. //ioprio_set
  377. //kexec_load
  378. //lookup_dcookie // oprofile only?
  379. //migrate_pages // NUMA
  380. //modify_ldt
  381. //mount
  382. //move_pages // NUMA
  383. //name_to_handle_at // NFS server
  384. //nfsservctl // NFS server
  385. //open_by_handle_at // NFS server
  386. //perf_event_open
  387. //pivot_root
  388. //process_vm_readv // For debugger
  389. //process_vm_writev // For debugger
  390. //ptrace // For debugger
  391. //query_module
  392. //quotactl
  393. //reboot
  394. //setdomainname
  395. //sethostname
  396. //setns
  397. //settimeofday
  398. //sgetmask // Obsolete
  399. //ssetmask // Obsolete
  400. //stime
  401. //swapoff
  402. //swapon
  403. //_sysctl
  404. //sysfs
  405. //sys_setaltroot
  406. //umount
  407. //umount2
  408. //unshare
  409. //uselib
  410. //vhangup
  411. //vm86
  412. //vm86old
  413. // Kernel key management
  414. //add_key
  415. //keyctl
  416. //request_key
  417. // Unimplemented
  418. //afs_syscall
  419. //break
  420. //ftime
  421. //getpmsg
  422. //gtty
  423. //lock
  424. //madvise1
  425. //mpx
  426. //prof
  427. //profil
  428. //putpmsg
  429. //security
  430. //stty
  431. //tuxcall
  432. //ulimit
  433. //vserver