2017-01-19 17:10:47 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
2017-06-28 15:47:31 +00:00
|
|
|
|
|
|
|
"golang.org/x/sys/unix"
|
2017-01-19 17:10:47 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
2017-06-28 15:47:31 +00:00
|
|
|
// SeccompModeFilter refers to the unix argument SECCOMP_MODE_FILTER.
|
2017-01-19 17:10:47 +00:00
|
|
|
SeccompModeFilter = uintptr(2)
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
// Check if Seccomp is supported, via CONFIG_SECCOMP.
|
2017-06-28 15:47:31 +00:00
|
|
|
if _, _, err := unix.RawSyscall(unix.SYS_PRCTL, unix.PR_GET_SECCOMP, 0, 0); err != unix.EINVAL {
|
2017-01-19 17:10:47 +00:00
|
|
|
// Make sure the kernel has CONFIG_SECCOMP_FILTER.
|
2017-06-28 15:47:31 +00:00
|
|
|
if _, _, err := unix.RawSyscall(unix.SYS_PRCTL, unix.PR_SET_SECCOMP, SeccompModeFilter, 0); err != unix.EINVAL {
|
2017-01-19 17:10:47 +00:00
|
|
|
os.Exit(0)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
os.Exit(1)
|
|
|
|
}
|