Commit Graph

7 Commits

Author SHA1 Message Date
Oleksandr Redko ba4c7c98bb chore: remove outdated build constraints
Signed-off-by: Oleksandr Redko <Oleksandr_Redko@epam.com>
2024-01-03 22:56:00 +02:00
Valentin Rothberg 095aded91c go fmt: use go 1.18 conditional-build syntax
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-03-18 11:04:40 +01:00
Kir Kolyshkin c9a7d176a1 pkg/seccomp: use sync.Once to speed up IsSupported
It does not make sense to check if seccomp is supported by the kernel
more than once per runtime, so let's use sync.Once to speed it up.

A quick benchmark:

BenchmarkIsSupported-4       	  1252161	       947 ns/op
BenchmarkIsSupportedOnce-4   	666274008	      2.14 ns/op

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2021-03-24 13:38:18 -07:00
Kir Kolyshkin 2f8a504f7c pkg/seccomp: simplify IsSupported
Current implementation of seccomp.IsSupported (rooted in runc) is not
very good.

First, it parses the whole /proc/self/status, adding each key: value
pair into the map (lots of allocations and future work for garbage
collector), when using a single key from that map.

Second, the presence of "Seccomp" key in /proc/self/status merely means
that kernel option CONFIG_SECCOMP is set, but there is a need to _also_
check for CONFIG_SECCOMP_FILTER (the code for which exists but never
executed in case /proc/self/status has Seccomp key).

Replace all this with a single call to prctl; see the long comment in
the code for details.

NOTE historically, parsing /proc/self/status was added after a concern
was raised in https://github.com/opencontainers/runc/pull/471 that
prctl(PR_GET_SECCOMP, ...) can result in the calling process being
killed with SIGKILL. This is a valid concern, so the new code here
does not use PR_GET_SECCOMP at all.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2021-03-23 17:58:36 -07:00
Daniel J Walsh 70d93c6deb Fix building on non linux platforms
Currently this code is not building correctly on darwin builds.
This PR handles non linux platforms correctly.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-12-21 13:33:12 -05:00
Daniel J Walsh f9bd8a21b0 Move some volume and device parsing from buildah to common
We want to split out buildah/pkg/parse for components other
containers/engines are using without pulling in the buildah library.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-11-18 08:43:35 -05:00
Sascha Grunert 5f1c701c68 Migrate seccomp/containers-golang
This migrates the repository from github.com/seccomp/containers-golang
into this library.

Signed-off-by: Sascha Grunert <sgrunert@suse.com>
2020-08-27 10:15:31 +02:00