Files
podman/test/checkseccomp/checkseccomp_linux.go
Kir Kolyshkin c6189c5b51 test/checkseccomp: add linux build tag
This is a linux-only binary.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-04-02 13:35:14 -07:00

21 lines
413 B
Go

//go:build seccomp
package main
import (
"os"
"golang.org/x/sys/unix"
)
func main() {
// Check if Seccomp is supported, via CONFIG_SECCOMP.
if err := unix.Prctl(unix.PR_GET_SECCOMP, 0, 0, 0, 0); err != unix.EINVAL {
// Make sure the kernel has CONFIG_SECCOMP_FILTER.
if err := unix.Prctl(unix.PR_SET_SECCOMP, unix.SECCOMP_MODE_FILTER, 0, 0, 0); err != unix.EINVAL {
os.Exit(0)
}
}
os.Exit(1)
}