mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-12-04 05:37:08 +00:00
Bump runc to d5b4a3e
This fixes a race condition in runc/systemd at container creation time opencontainers/runc#1683 Signed-off-by: vikaschoudhary16 <vichoudh@redhat.com>
This commit is contained in:
committed by
vikaschoudhary16
parent
81192eafd5
commit
4711bccd05
1
vendor/github.com/opencontainers/runc/libcontainer/apparmor/BUILD
generated
vendored
1
vendor/github.com/opencontainers/runc/libcontainer/apparmor/BUILD
generated
vendored
@@ -38,7 +38,6 @@ go_library(
|
||||
],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
cgo = True,
|
||||
importpath = "github.com/opencontainers/runc/libcontainer/apparmor",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
37
vendor/github.com/opencontainers/runc/libcontainer/apparmor/apparmor.go
generated
vendored
37
vendor/github.com/opencontainers/runc/libcontainer/apparmor/apparmor.go
generated
vendored
@@ -2,15 +2,10 @@
|
||||
|
||||
package apparmor
|
||||
|
||||
// #cgo LDFLAGS: -lapparmor
|
||||
// #include <sys/apparmor.h>
|
||||
// #include <stdlib.h>
|
||||
import "C"
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
// IsEnabled returns true if apparmor is enabled for the host.
|
||||
@@ -24,16 +19,36 @@ func IsEnabled() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func setprocattr(attr, value string) error {
|
||||
// Under AppArmor you can only change your own attr, so use /proc/self/
|
||||
// instead of /proc/<tid>/ like libapparmor does
|
||||
path := fmt.Sprintf("/proc/self/attr/%s", attr)
|
||||
|
||||
f, err := os.OpenFile(path, os.O_WRONLY, 0)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
_, err = fmt.Fprintf(f, "%s", value)
|
||||
return err
|
||||
}
|
||||
|
||||
// changeOnExec reimplements aa_change_onexec from libapparmor in Go
|
||||
func changeOnExec(name string) error {
|
||||
value := "exec " + name
|
||||
if err := setprocattr("exec", value); err != nil {
|
||||
return fmt.Errorf("apparmor failed to apply profile: %s", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// ApplyProfile will apply the profile with the specified name to the process after
|
||||
// the next exec.
|
||||
func ApplyProfile(name string) error {
|
||||
if name == "" {
|
||||
return nil
|
||||
}
|
||||
cName := C.CString(name)
|
||||
defer C.free(unsafe.Pointer(cName))
|
||||
if _, err := C.aa_change_onexec(cName); err != nil {
|
||||
return fmt.Errorf("apparmor failed to apply profile: %s", err)
|
||||
}
|
||||
return nil
|
||||
|
||||
return changeOnExec(name)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user