|
| 1 | +Backported from upstream 5d9bf7d1398f645882e5c2becc7815daa1770c26 |
| 2 | + |
| 3 | +Signed-off-by: Akihiro Suda < [email protected]> |
| 4 | +Signed-off-by: Henry Beberman < [email protected]> |
| 5 | + |
| 6 | +diff -Naur a/contrib/apparmor/apparmor.go b/contrib/apparmor/apparmor.go |
| 7 | +--- a/contrib/apparmor/apparmor.go 2024-02-09 13:19:03.000000000 +0000 |
| 8 | ++++ b/contrib/apparmor/apparmor.go 2024-02-22 00:22:43.993021818 +0000 |
| 9 | +@@ -39,6 +39,11 @@ |
| 10 | + |
| 11 | + // WithDefaultProfile will generate a default apparmor profile under the provided name |
| 12 | + // for the container. It is only generated if a profile under that name does not exist. |
| 13 | ++// |
| 14 | ++// FIXME: pkg/cri/[sb]server/container_create_linux_test.go depends on go:noinline |
| 15 | ++// since Go 1.21. |
| 16 | ++// |
| 17 | ++//go:noinline |
| 18 | + func WithDefaultProfile(name string) oci.SpecOpts { |
| 19 | + return func(_ context.Context, _ oci.Client, _ *containers.Container, s *specs.Spec) error { |
| 20 | + if err := LoadDefaultProfile(name); err != nil { |
| 21 | +diff -Naur a/contrib/seccomp/seccomp.go b/contrib/seccomp/seccomp.go |
| 22 | +--- a/contrib/seccomp/seccomp.go 2024-02-09 13:19:03.000000000 +0000 |
| 23 | ++++ b/contrib/seccomp/seccomp.go 2024-02-22 00:49:25.471844786 +0000 |
| 24 | +@@ -30,6 +30,11 @@ |
| 25 | + // WithProfile receives the name of a file stored on disk comprising a json |
| 26 | + // formatted seccomp profile, as specified by the opencontainers/runtime-spec. |
| 27 | + // The profile is read from the file, unmarshaled, and set to the spec. |
| 28 | ++// |
| 29 | ++// FIXME: pkg/cri/[sb]server/container_create_linux_test.go depends on go:noinline |
| 30 | ++// since Go 1.21. |
| 31 | ++// |
| 32 | ++//go:noinline |
| 33 | + func WithProfile(profile string) oci.SpecOpts { |
| 34 | + return func(_ context.Context, _ oci.Client, _ *containers.Container, s *specs.Spec) error { |
| 35 | + s.Linux.Seccomp = &specs.LinuxSeccomp{} |
| 36 | +@@ -46,6 +51,11 @@ |
| 37 | + |
| 38 | + // WithDefaultProfile sets the default seccomp profile to the spec. |
| 39 | + // Note: must follow the setting of process capabilities |
| 40 | ++// |
| 41 | ++// FIXME: pkg/cri/[sb]server/container_create_linux_test.go depends on go:noinline |
| 42 | ++// since Go 1.21. |
| 43 | ++// |
| 44 | ++//go:noinline |
| 45 | + func WithDefaultProfile() oci.SpecOpts { |
| 46 | + return func(_ context.Context, _ oci.Client, _ *containers.Container, s *specs.Spec) error { |
| 47 | + s.Linux.Seccomp = DefaultProfile(s) |
0 commit comments