mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 09:22:44 +00:00
Bump runc to v1.1.9
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
This commit is contained in:
parent
3cf3702d1e
commit
a926f594da
2
go.mod
2
go.mod
@ -53,7 +53,7 @@ require (
|
|||||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822
|
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822
|
||||||
github.com/onsi/ginkgo/v2 v2.9.4
|
github.com/onsi/ginkgo/v2 v2.9.4
|
||||||
github.com/onsi/gomega v1.27.6
|
github.com/onsi/gomega v1.27.6
|
||||||
github.com/opencontainers/runc v1.1.7
|
github.com/opencontainers/runc v1.1.9
|
||||||
github.com/opencontainers/selinux v1.10.0
|
github.com/opencontainers/selinux v1.10.0
|
||||||
github.com/pkg/errors v0.9.1
|
github.com/pkg/errors v0.9.1
|
||||||
github.com/pmezard/go-difflib v1.0.0
|
github.com/pmezard/go-difflib v1.0.0
|
||||||
|
4
go.sum
4
go.sum
@ -685,8 +685,8 @@ github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3I
|
|||||||
github.com/opencontainers/image-spec v1.0.2 h1:9yCKha/T5XdGtO0q9Q9a6T5NUCsTn/DrBg0D7ufOcFM=
|
github.com/opencontainers/image-spec v1.0.2 h1:9yCKha/T5XdGtO0q9Q9a6T5NUCsTn/DrBg0D7ufOcFM=
|
||||||
github.com/opencontainers/image-spec v1.0.2/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0=
|
github.com/opencontainers/image-spec v1.0.2/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0=
|
||||||
github.com/opencontainers/runc v1.1.4/go.mod h1:1J5XiS+vdZ3wCyZybsuxXZWGrgSr8fFJHLXuG2PsnNg=
|
github.com/opencontainers/runc v1.1.4/go.mod h1:1J5XiS+vdZ3wCyZybsuxXZWGrgSr8fFJHLXuG2PsnNg=
|
||||||
github.com/opencontainers/runc v1.1.7 h1:y2EZDS8sNng4Ksf0GUYNhKbTShZJPJg1FiXJNH/uoCk=
|
github.com/opencontainers/runc v1.1.9 h1:XR0VIHTGce5eWPkaPesqTBrhW2yAcaraWfsEalNwQLM=
|
||||||
github.com/opencontainers/runc v1.1.7/go.mod h1:CbUumNnWCuTGFukNXahoo/RFBZvDAgRh/smNYNOhA50=
|
github.com/opencontainers/runc v1.1.9/go.mod h1:CbUumNnWCuTGFukNXahoo/RFBZvDAgRh/smNYNOhA50=
|
||||||
github.com/opencontainers/runtime-spec v1.0.2/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0=
|
github.com/opencontainers/runtime-spec v1.0.2/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0=
|
||||||
github.com/opencontainers/runtime-spec v1.0.3-0.20200929063507-e6143ca7d51d/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0=
|
github.com/opencontainers/runtime-spec v1.0.3-0.20200929063507-e6143ca7d51d/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0=
|
||||||
github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0=
|
github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0=
|
||||||
|
24
vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs2/memory.go
generated
vendored
24
vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs2/memory.go
generated
vendored
@ -101,8 +101,9 @@ func statMemory(dirPath string, stats *cgroups.Stats) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
if errors.Is(err, unix.ENOENT) && dirPath == UnifiedMountpoint {
|
if errors.Is(err, unix.ENOENT) && dirPath == UnifiedMountpoint {
|
||||||
// The root cgroup does not have memory.{current,max}
|
// The root cgroup does not have memory.{current,max}
|
||||||
// so emulate those using data from /proc/meminfo.
|
// so emulate those using data from /proc/meminfo and
|
||||||
return statsFromMeminfo(stats)
|
// /sys/fs/cgroup/memory.stat
|
||||||
|
return rootStatsFromMeminfo(stats)
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -154,7 +155,7 @@ func getMemoryDataV2(path, name string) (cgroups.MemoryData, error) {
|
|||||||
return memoryData, nil
|
return memoryData, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func statsFromMeminfo(stats *cgroups.Stats) error {
|
func rootStatsFromMeminfo(stats *cgroups.Stats) error {
|
||||||
const file = "/proc/meminfo"
|
const file = "/proc/meminfo"
|
||||||
f, err := os.Open(file)
|
f, err := os.Open(file)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -166,14 +167,10 @@ func statsFromMeminfo(stats *cgroups.Stats) error {
|
|||||||
var (
|
var (
|
||||||
swap_free uint64
|
swap_free uint64
|
||||||
swap_total uint64
|
swap_total uint64
|
||||||
main_total uint64
|
|
||||||
main_free uint64
|
|
||||||
)
|
)
|
||||||
mem := map[string]*uint64{
|
mem := map[string]*uint64{
|
||||||
"SwapFree": &swap_free,
|
"SwapFree": &swap_free,
|
||||||
"SwapTotal": &swap_total,
|
"SwapTotal": &swap_total,
|
||||||
"MemTotal": &main_total,
|
|
||||||
"MemFree": &main_free,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
found := 0
|
found := 0
|
||||||
@ -206,11 +203,18 @@ func statsFromMeminfo(stats *cgroups.Stats) error {
|
|||||||
return &parseError{Path: "", File: file, Err: err}
|
return &parseError{Path: "", File: file, Err: err}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// cgroup v1 `usage_in_bytes` reports memory usage as the sum of
|
||||||
|
// - rss (NR_ANON_MAPPED)
|
||||||
|
// - cache (NR_FILE_PAGES)
|
||||||
|
// cgroup v1 reports SwapUsage values as mem+swap combined
|
||||||
|
// cgroup v2 reports rss and cache as anon and file.
|
||||||
|
// sum `anon` + `file` to report the same value as `usage_in_bytes` in v1.
|
||||||
|
// sum swap usage as combined mem+swap usage for consistency as well.
|
||||||
|
stats.MemoryStats.Usage.Usage = stats.MemoryStats.Stats["anon"] + stats.MemoryStats.Stats["file"]
|
||||||
|
stats.MemoryStats.Usage.Limit = math.MaxUint64
|
||||||
stats.MemoryStats.SwapUsage.Usage = (swap_total - swap_free) * 1024
|
stats.MemoryStats.SwapUsage.Usage = (swap_total - swap_free) * 1024
|
||||||
stats.MemoryStats.SwapUsage.Limit = math.MaxUint64
|
stats.MemoryStats.SwapUsage.Limit = math.MaxUint64
|
||||||
|
stats.MemoryStats.SwapUsage.Usage += stats.MemoryStats.Usage.Usage
|
||||||
stats.MemoryStats.Usage.Usage = (main_total - main_free) * 1024
|
|
||||||
stats.MemoryStats.Usage.Limit = math.MaxUint64
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
20
vendor/github.com/opencontainers/runc/libcontainer/cgroups/systemd/common.go
generated
vendored
20
vendor/github.com/opencontainers/runc/libcontainer/cgroups/systemd/common.go
generated
vendored
@ -370,7 +370,10 @@ retry:
|
|||||||
// In case a unit with the same name exists, this may
|
// In case a unit with the same name exists, this may
|
||||||
// be a leftover failed unit. Reset it, so systemd can
|
// be a leftover failed unit. Reset it, so systemd can
|
||||||
// remove it, and retry once.
|
// remove it, and retry once.
|
||||||
resetFailedUnit(cm, unitName)
|
err = resetFailedUnit(cm, unitName)
|
||||||
|
if err != nil {
|
||||||
|
logrus.Warnf("unable to reset failed unit: %v", err)
|
||||||
|
}
|
||||||
retry = false
|
retry = false
|
||||||
goto retry
|
goto retry
|
||||||
}
|
}
|
||||||
@ -385,11 +388,11 @@ retry:
|
|||||||
close(statusChan)
|
close(statusChan)
|
||||||
// Please refer to https://pkg.go.dev/github.com/coreos/go-systemd/v22/dbus#Conn.StartUnit
|
// Please refer to https://pkg.go.dev/github.com/coreos/go-systemd/v22/dbus#Conn.StartUnit
|
||||||
if s != "done" {
|
if s != "done" {
|
||||||
resetFailedUnit(cm, unitName)
|
_ = resetFailedUnit(cm, unitName)
|
||||||
return fmt.Errorf("error creating systemd unit `%s`: got `%s`", unitName, s)
|
return fmt.Errorf("error creating systemd unit `%s`: got `%s`", unitName, s)
|
||||||
}
|
}
|
||||||
case <-timeout.C:
|
case <-timeout.C:
|
||||||
resetFailedUnit(cm, unitName)
|
_ = resetFailedUnit(cm, unitName)
|
||||||
return errors.New("Timeout waiting for systemd to create " + unitName)
|
return errors.New("Timeout waiting for systemd to create " + unitName)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -417,16 +420,17 @@ func stopUnit(cm *dbusConnManager, unitName string) error {
|
|||||||
return errors.New("Timed out while waiting for systemd to remove " + unitName)
|
return errors.New("Timed out while waiting for systemd to remove " + unitName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// In case of a failed unit, let systemd remove it.
|
||||||
|
_ = resetFailedUnit(cm, unitName)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func resetFailedUnit(cm *dbusConnManager, name string) {
|
func resetFailedUnit(cm *dbusConnManager, name string) error {
|
||||||
err := cm.retryOnDisconnect(func(c *systemdDbus.Conn) error {
|
return cm.retryOnDisconnect(func(c *systemdDbus.Conn) error {
|
||||||
return c.ResetFailedUnitContext(context.TODO(), name)
|
return c.ResetFailedUnitContext(context.TODO(), name)
|
||||||
})
|
})
|
||||||
if err != nil {
|
|
||||||
logrus.Warnf("unable to reset failed unit: %v", err)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func getUnitTypeProperty(cm *dbusConnManager, unitName string, unitType string, propertyName string) (*systemdDbus.Property, error) {
|
func getUnitTypeProperty(cm *dbusConnManager, unitName string, unitType string, propertyName string) (*systemdDbus.Property, error) {
|
||||||
|
9
vendor/github.com/opencontainers/runc/libcontainer/cgroups/systemd/v1.go
generated
vendored
9
vendor/github.com/opencontainers/runc/libcontainer/cgroups/systemd/v1.go
generated
vendored
@ -417,6 +417,15 @@ func (m *legacyManager) Set(r *configs.Resources) error {
|
|||||||
if err := m.doFreeze(configs.Frozen); err != nil {
|
if err := m.doFreeze(configs.Frozen); err != nil {
|
||||||
// If freezer cgroup isn't supported, we just warn about it.
|
// If freezer cgroup isn't supported, we just warn about it.
|
||||||
logrus.Infof("freeze container before SetUnitProperties failed: %v", err)
|
logrus.Infof("freeze container before SetUnitProperties failed: %v", err)
|
||||||
|
// skip update the cgroup while frozen failed. #3803
|
||||||
|
if !errors.Is(err, errSubsystemDoesNotExist) {
|
||||||
|
if needsThaw {
|
||||||
|
if thawErr := m.doFreeze(configs.Thawed); thawErr != nil {
|
||||||
|
logrus.Infof("thaw container after doFreeze failed: %v", thawErr)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setErr := setUnitProperties(m.dbus, unitName, properties...)
|
setErr := setUnitProperties(m.dbus, unitName, properties...)
|
||||||
|
29
vendor/github.com/opencontainers/runc/libcontainer/container_linux.go
generated
vendored
29
vendor/github.com/opencontainers/runc/libcontainer/container_linux.go
generated
vendored
@ -40,7 +40,7 @@ type linuxContainer struct {
|
|||||||
root string
|
root string
|
||||||
config *configs.Config
|
config *configs.Config
|
||||||
cgroupManager cgroups.Manager
|
cgroupManager cgroups.Manager
|
||||||
intelRdtManager intelrdt.Manager
|
intelRdtManager *intelrdt.Manager
|
||||||
initPath string
|
initPath string
|
||||||
initArgs []string
|
initArgs []string
|
||||||
initProcess parentProcess
|
initProcess parentProcess
|
||||||
@ -146,19 +146,21 @@ func (c *linuxContainer) OCIState() (*specs.State, error) {
|
|||||||
return c.currentOCIState()
|
return c.currentOCIState()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *linuxContainer) Processes() ([]int, error) {
|
// ignoreCgroupError filters out cgroup-related errors that can be ignored,
|
||||||
var pids []int
|
// because the container is stopped and its cgroup is gone.
|
||||||
status, err := c.currentStatus()
|
func (c *linuxContainer) ignoreCgroupError(err error) error {
|
||||||
if err != nil {
|
if err == nil {
|
||||||
return pids, err
|
return nil
|
||||||
}
|
}
|
||||||
// for systemd cgroup, the unit's cgroup path will be auto removed if container's all processes exited
|
if errors.Is(err, os.ErrNotExist) && c.runType() == Stopped && !c.cgroupManager.Exists() {
|
||||||
if status == Stopped && !c.cgroupManager.Exists() {
|
return nil
|
||||||
return pids, nil
|
|
||||||
}
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
pids, err = c.cgroupManager.GetAllPids()
|
func (c *linuxContainer) Processes() ([]int, error) {
|
||||||
if err != nil {
|
pids, err := c.cgroupManager.GetAllPids()
|
||||||
|
if err = c.ignoreCgroupError(err); err != nil {
|
||||||
return nil, fmt.Errorf("unable to get all container pids: %w", err)
|
return nil, fmt.Errorf("unable to get all container pids: %w", err)
|
||||||
}
|
}
|
||||||
return pids, nil
|
return pids, nil
|
||||||
@ -382,11 +384,12 @@ func (c *linuxContainer) Signal(s os.Signal, all bool) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if all {
|
if all {
|
||||||
// for systemd cgroup, the unit's cgroup path will be auto removed if container's all processes exited
|
|
||||||
if status == Stopped && !c.cgroupManager.Exists() {
|
if status == Stopped && !c.cgroupManager.Exists() {
|
||||||
|
// Avoid calling signalAllProcesses which may print
|
||||||
|
// a warning trying to freeze a non-existing cgroup.
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return signalAllProcesses(c.cgroupManager, s)
|
return c.ignoreCgroupError(signalAllProcesses(c.cgroupManager, s))
|
||||||
}
|
}
|
||||||
// to avoid a PID reuse attack
|
// to avoid a PID reuse attack
|
||||||
if status == Running || status == Created || status == Paused {
|
if status == Running || status == Created || status == Paused {
|
||||||
|
43
vendor/github.com/opencontainers/runc/libcontainer/factory_linux.go
generated
vendored
43
vendor/github.com/opencontainers/runc/libcontainer/factory_linux.go
generated
vendored
@ -48,20 +48,6 @@ func InitArgs(args ...string) func(*LinuxFactory) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// IntelRdtfs is an options func to configure a LinuxFactory to return
|
|
||||||
// containers that use the Intel RDT "resource control" filesystem to
|
|
||||||
// create and manage Intel RDT resources (e.g., L3 cache, memory bandwidth).
|
|
||||||
func IntelRdtFs(l *LinuxFactory) error {
|
|
||||||
if !intelrdt.IsCATEnabled() && !intelrdt.IsMBAEnabled() {
|
|
||||||
l.NewIntelRdtManager = nil
|
|
||||||
} else {
|
|
||||||
l.NewIntelRdtManager = func(config *configs.Config, id string, path string) intelrdt.Manager {
|
|
||||||
return intelrdt.NewManager(config, id, path)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// TmpfsRoot is an option func to mount LinuxFactory.Root to tmpfs.
|
// TmpfsRoot is an option func to mount LinuxFactory.Root to tmpfs.
|
||||||
func TmpfsRoot(l *LinuxFactory) error {
|
func TmpfsRoot(l *LinuxFactory) error {
|
||||||
mounted, err := mountinfo.Mounted(l.Root)
|
mounted, err := mountinfo.Mounted(l.Root)
|
||||||
@ -136,9 +122,6 @@ type LinuxFactory struct {
|
|||||||
|
|
||||||
// Validator provides validation to container configurations.
|
// Validator provides validation to container configurations.
|
||||||
Validator validate.Validator
|
Validator validate.Validator
|
||||||
|
|
||||||
// NewIntelRdtManager returns an initialized Intel RDT manager for a single container.
|
|
||||||
NewIntelRdtManager func(config *configs.Config, id string, path string) intelrdt.Manager
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *LinuxFactory) Create(id string, config *configs.Config) (Container, error) {
|
func (l *LinuxFactory) Create(id string, config *configs.Config) (Container, error) {
|
||||||
@ -208,18 +191,16 @@ func (l *LinuxFactory) Create(id string, config *configs.Config) (Container, err
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
c := &linuxContainer{
|
c := &linuxContainer{
|
||||||
id: id,
|
id: id,
|
||||||
root: containerRoot,
|
root: containerRoot,
|
||||||
config: config,
|
config: config,
|
||||||
initPath: l.InitPath,
|
initPath: l.InitPath,
|
||||||
initArgs: l.InitArgs,
|
initArgs: l.InitArgs,
|
||||||
criuPath: l.CriuPath,
|
criuPath: l.CriuPath,
|
||||||
newuidmapPath: l.NewuidmapPath,
|
newuidmapPath: l.NewuidmapPath,
|
||||||
newgidmapPath: l.NewgidmapPath,
|
newgidmapPath: l.NewgidmapPath,
|
||||||
cgroupManager: cm,
|
cgroupManager: cm,
|
||||||
}
|
intelRdtManager: intelrdt.NewManager(config, id, ""),
|
||||||
if l.NewIntelRdtManager != nil {
|
|
||||||
c.intelRdtManager = l.NewIntelRdtManager(config, id, "")
|
|
||||||
}
|
}
|
||||||
c.state = &stoppedState{c: c}
|
c.state = &stoppedState{c: c}
|
||||||
return c, nil
|
return c, nil
|
||||||
@ -261,12 +242,10 @@ func (l *LinuxFactory) Load(id string) (Container, error) {
|
|||||||
newuidmapPath: l.NewuidmapPath,
|
newuidmapPath: l.NewuidmapPath,
|
||||||
newgidmapPath: l.NewgidmapPath,
|
newgidmapPath: l.NewgidmapPath,
|
||||||
cgroupManager: cm,
|
cgroupManager: cm,
|
||||||
|
intelRdtManager: intelrdt.NewManager(&state.Config, id, state.IntelRdtPath),
|
||||||
root: containerRoot,
|
root: containerRoot,
|
||||||
created: state.Created,
|
created: state.Created,
|
||||||
}
|
}
|
||||||
if l.NewIntelRdtManager != nil {
|
|
||||||
c.intelRdtManager = l.NewIntelRdtManager(&state.Config, id, state.IntelRdtPath)
|
|
||||||
}
|
|
||||||
c.state = &loadedState{c: c}
|
c.state = &loadedState{c: c}
|
||||||
if err := c.refreshState(); err != nil {
|
if err := c.refreshState(); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
8
vendor/github.com/opencontainers/runc/libcontainer/init_linux.go
generated
vendored
8
vendor/github.com/opencontainers/runc/libcontainer/init_linux.go
generated
vendored
@ -116,17 +116,17 @@ func populateProcessEnvironment(env []string) error {
|
|||||||
for _, pair := range env {
|
for _, pair := range env {
|
||||||
p := strings.SplitN(pair, "=", 2)
|
p := strings.SplitN(pair, "=", 2)
|
||||||
if len(p) < 2 {
|
if len(p) < 2 {
|
||||||
return fmt.Errorf("invalid environment variable: %q", pair)
|
return errors.New("invalid environment variable: missing '='")
|
||||||
}
|
}
|
||||||
name, val := p[0], p[1]
|
name, val := p[0], p[1]
|
||||||
if name == "" {
|
if name == "" {
|
||||||
return fmt.Errorf("environment variable name can't be empty: %q", pair)
|
return errors.New("invalid environment variable: name cannot be empty")
|
||||||
}
|
}
|
||||||
if strings.IndexByte(name, 0) >= 0 {
|
if strings.IndexByte(name, 0) >= 0 {
|
||||||
return fmt.Errorf("environment variable name can't contain null(\\x00): %q", pair)
|
return fmt.Errorf("invalid environment variable %q: name contains nul byte (\\x00)", name)
|
||||||
}
|
}
|
||||||
if strings.IndexByte(val, 0) >= 0 {
|
if strings.IndexByte(val, 0) >= 0 {
|
||||||
return fmt.Errorf("environment variable value can't contain null(\\x00): %q", pair)
|
return fmt.Errorf("invalid environment variable %q: value contains nul byte (\\x00)", name)
|
||||||
}
|
}
|
||||||
if err := os.Setenv(name, val); err != nil {
|
if err := os.Setenv(name, val); err != nil {
|
||||||
return err
|
return err
|
||||||
|
234
vendor/github.com/opencontainers/runc/libcontainer/intelrdt/intelrdt.go
generated
vendored
234
vendor/github.com/opencontainers/runc/libcontainer/intelrdt/intelrdt.go
generated
vendored
@ -1,11 +1,9 @@
|
|||||||
package intelrdt
|
package intelrdt
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bufio"
|
|
||||||
"bytes"
|
"bytes"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strconv"
|
"strconv"
|
||||||
@ -13,6 +11,8 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/moby/sys/mountinfo"
|
"github.com/moby/sys/mountinfo"
|
||||||
|
"golang.org/x/sys/unix"
|
||||||
|
|
||||||
"github.com/opencontainers/runc/libcontainer/cgroups/fscommon"
|
"github.com/opencontainers/runc/libcontainer/cgroups/fscommon"
|
||||||
"github.com/opencontainers/runc/libcontainer/configs"
|
"github.com/opencontainers/runc/libcontainer/configs"
|
||||||
)
|
)
|
||||||
@ -145,34 +145,31 @@ import (
|
|||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
|
|
||||||
type Manager interface {
|
type Manager struct {
|
||||||
// Applies Intel RDT configuration to the process with the specified pid
|
|
||||||
Apply(pid int) error
|
|
||||||
|
|
||||||
// Returns statistics for Intel RDT
|
|
||||||
GetStats() (*Stats, error)
|
|
||||||
|
|
||||||
// Destroys the Intel RDT container-specific 'container_id' group
|
|
||||||
Destroy() error
|
|
||||||
|
|
||||||
// Returns Intel RDT path to save in a state file and to be able to
|
|
||||||
// restore the object later
|
|
||||||
GetPath() string
|
|
||||||
|
|
||||||
// Set Intel RDT "resource control" filesystem as configured.
|
|
||||||
Set(container *configs.Config) error
|
|
||||||
}
|
|
||||||
|
|
||||||
// This implements interface Manager
|
|
||||||
type intelRdtManager struct {
|
|
||||||
mu sync.Mutex
|
mu sync.Mutex
|
||||||
config *configs.Config
|
config *configs.Config
|
||||||
id string
|
id string
|
||||||
path string
|
path string
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewManager(config *configs.Config, id string, path string) Manager {
|
// NewManager returns a new instance of Manager, or nil if the Intel RDT
|
||||||
return &intelRdtManager{
|
// functionality is not specified in the config, available from hardware or
|
||||||
|
// enabled in the kernel.
|
||||||
|
func NewManager(config *configs.Config, id string, path string) *Manager {
|
||||||
|
if config.IntelRdt == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
if _, err := Root(); err != nil {
|
||||||
|
// Intel RDT is not available.
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return newManager(config, id, path)
|
||||||
|
}
|
||||||
|
|
||||||
|
// newManager is the same as NewManager, except it does not check if the feature
|
||||||
|
// is actually available. Used by unit tests that mock intelrdt paths.
|
||||||
|
func newManager(config *configs.Config, id string, path string) *Manager {
|
||||||
|
return &Manager{
|
||||||
config: config,
|
config: config,
|
||||||
id: id,
|
id: id,
|
||||||
path: path,
|
path: path,
|
||||||
@ -188,71 +185,52 @@ var (
|
|||||||
catEnabled bool
|
catEnabled bool
|
||||||
// The flag to indicate if Intel RDT/MBA is enabled
|
// The flag to indicate if Intel RDT/MBA is enabled
|
||||||
mbaEnabled bool
|
mbaEnabled bool
|
||||||
// The flag to indicate if Intel RDT/MBA Software Controller is enabled
|
|
||||||
mbaScEnabled bool
|
|
||||||
|
|
||||||
// For Intel RDT initialization
|
// For Intel RDT initialization
|
||||||
initOnce sync.Once
|
initOnce sync.Once
|
||||||
|
|
||||||
errNotFound = errors.New("Intel RDT resctrl mount point not found")
|
errNotFound = errors.New("Intel RDT not available")
|
||||||
)
|
)
|
||||||
|
|
||||||
// Check if Intel RDT sub-features are enabled in featuresInit()
|
// Check if Intel RDT sub-features are enabled in featuresInit()
|
||||||
func featuresInit() {
|
func featuresInit() {
|
||||||
initOnce.Do(func() {
|
initOnce.Do(func() {
|
||||||
// 1. Check if hardware and kernel support Intel RDT sub-features
|
// 1. Check if Intel RDT "resource control" filesystem is available.
|
||||||
flagsSet, err := parseCpuInfoFile("/proc/cpuinfo")
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// 2. Check if Intel RDT "resource control" filesystem is available.
|
|
||||||
// The user guarantees to mount the filesystem.
|
// The user guarantees to mount the filesystem.
|
||||||
root, err := Root()
|
root, err := Root()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. Double check if Intel RDT sub-features are available in
|
// 2. Check if Intel RDT sub-features are available in "resource
|
||||||
// "resource control" filesystem. Intel RDT sub-features can be
|
// control" filesystem. Intel RDT sub-features can be
|
||||||
// selectively disabled or enabled by kernel command line
|
// selectively disabled or enabled by kernel command line
|
||||||
// (e.g., rdt=!l3cat,mba) in 4.14 and newer kernel
|
// (e.g., rdt=!l3cat,mba) in 4.14 and newer kernel
|
||||||
if flagsSet.CAT {
|
if _, err := os.Stat(filepath.Join(root, "info", "L3")); err == nil {
|
||||||
if _, err := os.Stat(filepath.Join(root, "info", "L3")); err == nil {
|
catEnabled = true
|
||||||
catEnabled = true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if mbaScEnabled {
|
if _, err := os.Stat(filepath.Join(root, "info", "MB")); err == nil {
|
||||||
// We confirm MBA Software Controller is enabled in step 2,
|
|
||||||
// MBA should be enabled because MBA Software Controller
|
|
||||||
// depends on MBA
|
|
||||||
mbaEnabled = true
|
mbaEnabled = true
|
||||||
} else if flagsSet.MBA {
|
|
||||||
if _, err := os.Stat(filepath.Join(root, "info", "MB")); err == nil {
|
|
||||||
mbaEnabled = true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if flagsSet.MBMTotal || flagsSet.MBMLocal || flagsSet.CMT {
|
if _, err := os.Stat(filepath.Join(root, "info", "L3_MON")); err != nil {
|
||||||
if _, err := os.Stat(filepath.Join(root, "info", "L3_MON")); err != nil {
|
return
|
||||||
return
|
}
|
||||||
}
|
enabledMonFeatures, err = getMonFeatures(root)
|
||||||
enabledMonFeatures, err = getMonFeatures(root)
|
if err != nil {
|
||||||
if err != nil {
|
return
|
||||||
return
|
}
|
||||||
}
|
if enabledMonFeatures.mbmTotalBytes || enabledMonFeatures.mbmLocalBytes {
|
||||||
if enabledMonFeatures.mbmTotalBytes || enabledMonFeatures.mbmLocalBytes {
|
mbmEnabled = true
|
||||||
mbmEnabled = true
|
}
|
||||||
}
|
if enabledMonFeatures.llcOccupancy {
|
||||||
if enabledMonFeatures.llcOccupancy {
|
cmtEnabled = true
|
||||||
cmtEnabled = true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return the mount point path of Intel RDT "resource control" filesysem
|
// findIntelRdtMountpointDir returns the mount point of the Intel RDT "resource control" filesystem.
|
||||||
func findIntelRdtMountpointDir(f io.Reader) (string, error) {
|
func findIntelRdtMountpointDir() (string, error) {
|
||||||
mi, err := mountinfo.GetMountsFromReader(f, func(m *mountinfo.Info) (bool, bool) {
|
mi, err := mountinfo.GetMounts(func(m *mountinfo.Info) (bool, bool) {
|
||||||
// similar to mountinfo.FSTypeFilter but stops after the first match
|
// similar to mountinfo.FSTypeFilter but stops after the first match
|
||||||
if m.FSType == "resctrl" {
|
if m.FSType == "resctrl" {
|
||||||
return false, true // don't skip, stop
|
return false, true // don't skip, stop
|
||||||
@ -266,97 +244,45 @@ func findIntelRdtMountpointDir(f io.Reader) (string, error) {
|
|||||||
return "", errNotFound
|
return "", errNotFound
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if MBA Software Controller is enabled through mount option "-o mba_MBps"
|
|
||||||
if strings.Contains(","+mi[0].VFSOptions+",", ",mba_MBps,") {
|
|
||||||
mbaScEnabled = true
|
|
||||||
}
|
|
||||||
|
|
||||||
return mi[0].Mountpoint, nil
|
return mi[0].Mountpoint, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// For Root() use only.
|
// For Root() use only.
|
||||||
var (
|
var (
|
||||||
intelRdtRoot string
|
intelRdtRoot string
|
||||||
rootMu sync.Mutex
|
intelRdtRootErr error
|
||||||
|
rootOnce sync.Once
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// The kernel creates this (empty) directory if resctrl is supported by the
|
||||||
|
// hardware and kernel. The user is responsible for mounting the resctrl
|
||||||
|
// filesystem, and they could mount it somewhere else if they wanted to.
|
||||||
|
const defaultResctrlMountpoint = "/sys/fs/resctrl"
|
||||||
|
|
||||||
// Root returns the Intel RDT "resource control" filesystem mount point.
|
// Root returns the Intel RDT "resource control" filesystem mount point.
|
||||||
func Root() (string, error) {
|
func Root() (string, error) {
|
||||||
rootMu.Lock()
|
rootOnce.Do(func() {
|
||||||
defer rootMu.Unlock()
|
// Does this system support resctrl?
|
||||||
|
var statfs unix.Statfs_t
|
||||||
if intelRdtRoot != "" {
|
if err := unix.Statfs(defaultResctrlMountpoint, &statfs); err != nil {
|
||||||
return intelRdtRoot, nil
|
if errors.Is(err, unix.ENOENT) {
|
||||||
}
|
err = errNotFound
|
||||||
|
|
||||||
f, err := os.Open("/proc/self/mountinfo")
|
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
root, err := findIntelRdtMountpointDir(f)
|
|
||||||
f.Close()
|
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
|
|
||||||
if _, err := os.Stat(root); err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
|
|
||||||
intelRdtRoot = root
|
|
||||||
return intelRdtRoot, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type cpuInfoFlags struct {
|
|
||||||
CAT bool // Cache Allocation Technology
|
|
||||||
MBA bool // Memory Bandwidth Allocation
|
|
||||||
|
|
||||||
// Memory Bandwidth Monitoring related.
|
|
||||||
MBMTotal bool
|
|
||||||
MBMLocal bool
|
|
||||||
|
|
||||||
CMT bool // Cache Monitoring Technology
|
|
||||||
}
|
|
||||||
|
|
||||||
func parseCpuInfoFile(path string) (cpuInfoFlags, error) {
|
|
||||||
infoFlags := cpuInfoFlags{}
|
|
||||||
|
|
||||||
f, err := os.Open(path)
|
|
||||||
if err != nil {
|
|
||||||
return infoFlags, err
|
|
||||||
}
|
|
||||||
defer f.Close()
|
|
||||||
|
|
||||||
s := bufio.NewScanner(f)
|
|
||||||
for s.Scan() {
|
|
||||||
line := s.Text()
|
|
||||||
|
|
||||||
// Search "cat_l3" and "mba" flags in first "flags" line
|
|
||||||
if strings.HasPrefix(line, "flags") {
|
|
||||||
flags := strings.Split(line, " ")
|
|
||||||
// "cat_l3" flag for CAT and "mba" flag for MBA
|
|
||||||
for _, flag := range flags {
|
|
||||||
switch flag {
|
|
||||||
case "cat_l3":
|
|
||||||
infoFlags.CAT = true
|
|
||||||
case "mba":
|
|
||||||
infoFlags.MBA = true
|
|
||||||
case "cqm_mbm_total":
|
|
||||||
infoFlags.MBMTotal = true
|
|
||||||
case "cqm_mbm_local":
|
|
||||||
infoFlags.MBMLocal = true
|
|
||||||
case "cqm_occup_llc":
|
|
||||||
infoFlags.CMT = true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return infoFlags, nil
|
intelRdtRootErr = err
|
||||||
|
return
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if err := s.Err(); err != nil {
|
|
||||||
return infoFlags, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return infoFlags, nil
|
// Has the resctrl fs been mounted to the default mount point?
|
||||||
|
if statfs.Type == unix.RDTGROUP_SUPER_MAGIC {
|
||||||
|
intelRdtRoot = defaultResctrlMountpoint
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// The resctrl fs could have been mounted somewhere nonstandard.
|
||||||
|
intelRdtRoot, intelRdtRootErr = findIntelRdtMountpointDir()
|
||||||
|
})
|
||||||
|
|
||||||
|
return intelRdtRoot, intelRdtRootErr
|
||||||
}
|
}
|
||||||
|
|
||||||
// Gets a single uint64 value from the specified file.
|
// Gets a single uint64 value from the specified file.
|
||||||
@ -502,14 +428,8 @@ func IsMBAEnabled() bool {
|
|||||||
return mbaEnabled
|
return mbaEnabled
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if Intel RDT/MBA Software Controller is enabled
|
|
||||||
func IsMBAScEnabled() bool {
|
|
||||||
featuresInit()
|
|
||||||
return mbaScEnabled
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the path of the clos group in "resource control" filesystem that the container belongs to
|
// Get the path of the clos group in "resource control" filesystem that the container belongs to
|
||||||
func (m *intelRdtManager) getIntelRdtPath() (string, error) {
|
func (m *Manager) getIntelRdtPath() (string, error) {
|
||||||
rootPath, err := Root()
|
rootPath, err := Root()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
@ -524,7 +444,7 @@ func (m *intelRdtManager) getIntelRdtPath() (string, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Applies Intel RDT configuration to the process with the specified pid
|
// Applies Intel RDT configuration to the process with the specified pid
|
||||||
func (m *intelRdtManager) Apply(pid int) (err error) {
|
func (m *Manager) Apply(pid int) (err error) {
|
||||||
// If intelRdt is not specified in config, we do nothing
|
// If intelRdt is not specified in config, we do nothing
|
||||||
if m.config.IntelRdt == nil {
|
if m.config.IntelRdt == nil {
|
||||||
return nil
|
return nil
|
||||||
@ -559,11 +479,11 @@ func (m *intelRdtManager) Apply(pid int) (err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Destroys the Intel RDT container-specific 'container_id' group
|
// Destroys the Intel RDT container-specific 'container_id' group
|
||||||
func (m *intelRdtManager) Destroy() error {
|
func (m *Manager) Destroy() error {
|
||||||
// Don't remove resctrl group if closid has been explicitly specified. The
|
// Don't remove resctrl group if closid has been explicitly specified. The
|
||||||
// group is likely externally managed, i.e. by some other entity than us.
|
// group is likely externally managed, i.e. by some other entity than us.
|
||||||
// There are probably other containers/tasks sharing the same group.
|
// There are probably other containers/tasks sharing the same group.
|
||||||
if m.config.IntelRdt == nil || m.config.IntelRdt.ClosID == "" {
|
if m.config.IntelRdt != nil && m.config.IntelRdt.ClosID == "" {
|
||||||
m.mu.Lock()
|
m.mu.Lock()
|
||||||
defer m.mu.Unlock()
|
defer m.mu.Unlock()
|
||||||
if err := os.RemoveAll(m.GetPath()); err != nil {
|
if err := os.RemoveAll(m.GetPath()); err != nil {
|
||||||
@ -576,7 +496,7 @@ func (m *intelRdtManager) Destroy() error {
|
|||||||
|
|
||||||
// Returns Intel RDT path to save in a state file and to be able to
|
// Returns Intel RDT path to save in a state file and to be able to
|
||||||
// restore the object later
|
// restore the object later
|
||||||
func (m *intelRdtManager) GetPath() string {
|
func (m *Manager) GetPath() string {
|
||||||
if m.path == "" {
|
if m.path == "" {
|
||||||
m.path, _ = m.getIntelRdtPath()
|
m.path, _ = m.getIntelRdtPath()
|
||||||
}
|
}
|
||||||
@ -584,7 +504,7 @@ func (m *intelRdtManager) GetPath() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Returns statistics for Intel RDT
|
// Returns statistics for Intel RDT
|
||||||
func (m *intelRdtManager) GetStats() (*Stats, error) {
|
func (m *Manager) GetStats() (*Stats, error) {
|
||||||
// If intelRdt is not specified in config
|
// If intelRdt is not specified in config
|
||||||
if m.config.IntelRdt == nil {
|
if m.config.IntelRdt == nil {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
@ -670,7 +590,7 @@ func (m *intelRdtManager) GetStats() (*Stats, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set Intel RDT "resource control" filesystem as configured.
|
// Set Intel RDT "resource control" filesystem as configured.
|
||||||
func (m *intelRdtManager) Set(container *configs.Config) error {
|
func (m *Manager) Set(container *configs.Config) error {
|
||||||
// About L3 cache schema:
|
// About L3 cache schema:
|
||||||
// It has allocation bitmasks/values for L3 cache on each socket,
|
// It has allocation bitmasks/values for L3 cache on each socket,
|
||||||
// which contains L3 cache id and capacity bitmask (CBM).
|
// which contains L3 cache id and capacity bitmask (CBM).
|
||||||
|
18
vendor/github.com/opencontainers/runc/libcontainer/mount_linux.go
generated
vendored
18
vendor/github.com/opencontainers/runc/libcontainer/mount_linux.go
generated
vendored
@ -1,6 +1,7 @@
|
|||||||
package libcontainer
|
package libcontainer
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"io/fs"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"golang.org/x/sys/unix"
|
"golang.org/x/sys/unix"
|
||||||
@ -81,3 +82,20 @@ func unmount(target string, flags int) error {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// syscallMode returns the syscall-specific mode bits from Go's portable mode bits.
|
||||||
|
// Copy from https://cs.opensource.google/go/go/+/refs/tags/go1.20.7:src/os/file_posix.go;l=61-75
|
||||||
|
func syscallMode(i fs.FileMode) (o uint32) {
|
||||||
|
o |= uint32(i.Perm())
|
||||||
|
if i&fs.ModeSetuid != 0 {
|
||||||
|
o |= unix.S_ISUID
|
||||||
|
}
|
||||||
|
if i&fs.ModeSetgid != 0 {
|
||||||
|
o |= unix.S_ISGID
|
||||||
|
}
|
||||||
|
if i&fs.ModeSticky != 0 {
|
||||||
|
o |= unix.S_ISVTX
|
||||||
|
}
|
||||||
|
// No mapping for Go's ModeTemporary (plan9 only).
|
||||||
|
return
|
||||||
|
}
|
||||||
|
2
vendor/github.com/opencontainers/runc/libcontainer/process_linux.go
generated
vendored
2
vendor/github.com/opencontainers/runc/libcontainer/process_linux.go
generated
vendored
@ -299,7 +299,7 @@ type initProcess struct {
|
|||||||
logFilePair filePair
|
logFilePair filePair
|
||||||
config *initConfig
|
config *initConfig
|
||||||
manager cgroups.Manager
|
manager cgroups.Manager
|
||||||
intelRdtManager intelrdt.Manager
|
intelRdtManager *intelrdt.Manager
|
||||||
container *linuxContainer
|
container *linuxContainer
|
||||||
fds []string
|
fds []string
|
||||||
process *Process
|
process *Process
|
||||||
|
20
vendor/github.com/opencontainers/runc/libcontainer/rootfs_linux.go
generated
vendored
20
vendor/github.com/opencontainers/runc/libcontainer/rootfs_linux.go
generated
vendored
@ -459,11 +459,16 @@ func mountToRootfs(m *configs.Mount, c *mountConfig) error {
|
|||||||
}
|
}
|
||||||
return label.SetFileLabel(dest, mountLabel)
|
return label.SetFileLabel(dest, mountLabel)
|
||||||
case "tmpfs":
|
case "tmpfs":
|
||||||
stat, err := os.Stat(dest)
|
if stat, err := os.Stat(dest); err != nil {
|
||||||
if err != nil {
|
|
||||||
if err := os.MkdirAll(dest, 0o755); err != nil {
|
if err := os.MkdirAll(dest, 0o755); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
dt := fmt.Sprintf("mode=%04o", syscallMode(stat.Mode()))
|
||||||
|
if m.Data != "" {
|
||||||
|
dt = dt + "," + m.Data
|
||||||
|
}
|
||||||
|
m.Data = dt
|
||||||
}
|
}
|
||||||
|
|
||||||
if m.Extensions&configs.EXT_COPYUP == configs.EXT_COPYUP {
|
if m.Extensions&configs.EXT_COPYUP == configs.EXT_COPYUP {
|
||||||
@ -472,16 +477,7 @@ func mountToRootfs(m *configs.Mount, c *mountConfig) error {
|
|||||||
err = mountPropagate(m, rootfs, mountLabel, nil)
|
err = mountPropagate(m, rootfs, mountLabel, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
return err
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if stat != nil {
|
|
||||||
if err = os.Chmod(dest, stat.Mode()); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
case "bind":
|
case "bind":
|
||||||
if err := prepareBindMount(m, rootfs, mountFd); err != nil {
|
if err := prepareBindMount(m, rootfs, mountFd); err != nil {
|
||||||
return err
|
return err
|
||||||
|
1
vendor/github.com/opencontainers/runc/libcontainer/seccomp/config.go
generated
vendored
1
vendor/github.com/opencontainers/runc/libcontainer/seccomp/config.go
generated
vendored
@ -66,6 +66,7 @@ var archs = map[string]string{
|
|||||||
"SCMP_ARCH_PPC": "ppc",
|
"SCMP_ARCH_PPC": "ppc",
|
||||||
"SCMP_ARCH_PPC64": "ppc64",
|
"SCMP_ARCH_PPC64": "ppc64",
|
||||||
"SCMP_ARCH_PPC64LE": "ppc64le",
|
"SCMP_ARCH_PPC64LE": "ppc64le",
|
||||||
|
"SCMP_ARCH_RISCV64": "riscv64",
|
||||||
"SCMP_ARCH_S390": "s390",
|
"SCMP_ARCH_S390": "s390",
|
||||||
"SCMP_ARCH_S390X": "s390x",
|
"SCMP_ARCH_S390X": "s390x",
|
||||||
}
|
}
|
||||||
|
10
vendor/github.com/opencontainers/runc/libcontainer/seccomp/patchbpf/enosys_linux.go
generated
vendored
10
vendor/github.com/opencontainers/runc/libcontainer/seccomp/patchbpf/enosys_linux.go
generated
vendored
@ -48,6 +48,13 @@ const uintptr_t C_FILTER_FLAG_LOG = SECCOMP_FILTER_FLAG_LOG;
|
|||||||
#endif
|
#endif
|
||||||
const uintptr_t C_FILTER_FLAG_NEW_LISTENER = SECCOMP_FILTER_FLAG_NEW_LISTENER;
|
const uintptr_t C_FILTER_FLAG_NEW_LISTENER = SECCOMP_FILTER_FLAG_NEW_LISTENER;
|
||||||
|
|
||||||
|
#ifndef AUDIT_ARCH_RISCV64
|
||||||
|
#ifndef EM_RISCV
|
||||||
|
#define EM_RISCV 243
|
||||||
|
#endif
|
||||||
|
#define AUDIT_ARCH_RISCV64 (EM_RISCV|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
|
||||||
|
#endif
|
||||||
|
|
||||||
// We use the AUDIT_ARCH_* values because those are the ones used by the kernel
|
// We use the AUDIT_ARCH_* values because those are the ones used by the kernel
|
||||||
// and SCMP_ARCH_* sometimes has fake values (such as SCMP_ARCH_X32). But we
|
// and SCMP_ARCH_* sometimes has fake values (such as SCMP_ARCH_X32). But we
|
||||||
// use <seccomp.h> so we get libseccomp's fallback definitions of AUDIT_ARCH_*.
|
// use <seccomp.h> so we get libseccomp's fallback definitions of AUDIT_ARCH_*.
|
||||||
@ -67,6 +74,7 @@ const uint32_t C_AUDIT_ARCH_PPC64 = AUDIT_ARCH_PPC64;
|
|||||||
const uint32_t C_AUDIT_ARCH_PPC64LE = AUDIT_ARCH_PPC64LE;
|
const uint32_t C_AUDIT_ARCH_PPC64LE = AUDIT_ARCH_PPC64LE;
|
||||||
const uint32_t C_AUDIT_ARCH_S390 = AUDIT_ARCH_S390;
|
const uint32_t C_AUDIT_ARCH_S390 = AUDIT_ARCH_S390;
|
||||||
const uint32_t C_AUDIT_ARCH_S390X = AUDIT_ARCH_S390X;
|
const uint32_t C_AUDIT_ARCH_S390X = AUDIT_ARCH_S390X;
|
||||||
|
const uint32_t C_AUDIT_ARCH_RISCV64 = AUDIT_ARCH_RISCV64;
|
||||||
*/
|
*/
|
||||||
import "C"
|
import "C"
|
||||||
|
|
||||||
@ -202,6 +210,8 @@ func archToNative(arch libseccomp.ScmpArch) (nativeArch, error) {
|
|||||||
return nativeArch(C.C_AUDIT_ARCH_S390), nil
|
return nativeArch(C.C_AUDIT_ARCH_S390), nil
|
||||||
case libseccomp.ArchS390X:
|
case libseccomp.ArchS390X:
|
||||||
return nativeArch(C.C_AUDIT_ARCH_S390X), nil
|
return nativeArch(C.C_AUDIT_ARCH_S390X), nil
|
||||||
|
case libseccomp.ArchRISCV64:
|
||||||
|
return nativeArch(C.C_AUDIT_ARCH_RISCV64), nil
|
||||||
default:
|
default:
|
||||||
return invalidArch, fmt.Errorf("unknown architecture: %v", arch)
|
return invalidArch, fmt.Errorf("unknown architecture: %v", arch)
|
||||||
}
|
}
|
||||||
|
2
vendor/github.com/opencontainers/runc/libcontainer/user/user.go
generated
vendored
2
vendor/github.com/opencontainers/runc/libcontainer/user/user.go
generated
vendored
@ -201,7 +201,7 @@ func ParseGroupFilter(r io.Reader, filter func(Group) bool) ([]Group, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
// We should return no error if EOF is reached
|
// We should return no error if EOF is reached
|
||||||
// without a match.
|
// without a match.
|
||||||
if err == io.EOF { //nolint:errorlint // comparison with io.EOF is legit, https://github.com/polyfloyd/go-errorlint/pull/12
|
if err == io.EOF {
|
||||||
err = nil
|
err = nil
|
||||||
}
|
}
|
||||||
return out, err
|
return out, err
|
||||||
|
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
@ -565,7 +565,7 @@ github.com/onsi/gomega/types
|
|||||||
# github.com/opencontainers/go-digest v1.0.0
|
# github.com/opencontainers/go-digest v1.0.0
|
||||||
## explicit; go 1.13
|
## explicit; go 1.13
|
||||||
github.com/opencontainers/go-digest
|
github.com/opencontainers/go-digest
|
||||||
# github.com/opencontainers/runc v1.1.7
|
# github.com/opencontainers/runc v1.1.9
|
||||||
## explicit; go 1.17
|
## explicit; go 1.17
|
||||||
github.com/opencontainers/runc/libcontainer
|
github.com/opencontainers/runc/libcontainer
|
||||||
github.com/opencontainers/runc/libcontainer/apparmor
|
github.com/opencontainers/runc/libcontainer/apparmor
|
||||||
|
Loading…
Reference in New Issue
Block a user