Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions libcontainer/configs/validate/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,10 @@ func sysctl(config *configs.Config) error {

func intelrdtCheck(config *configs.Config) error {
if config.IntelRdt != nil {
if !intelrdt.IsEnabled() {
return fmt.Errorf("intelRdt is specified in config, but Intel RDT is not enabled")
}

if config.IntelRdt.ClosID == "." || config.IntelRdt.ClosID == ".." || strings.Contains(config.IntelRdt.ClosID, "/") {
return fmt.Errorf("invalid intelRdt.ClosID %q", config.IntelRdt.ClosID)
}
Expand Down
6 changes: 6 additions & 0 deletions libcontainer/intelrdt/intelrdt.go
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,12 @@ func WriteIntelRdtTasks(dir string, pid int) error {
return nil
}

// IsEnabled checks if Intel RDT is enabled.
func IsEnabled() bool {
fsroot, err := Root()
return err == nil && fsroot != ""
}

// IsCATEnabled checks if Intel RDT/CAT is enabled.
func IsCATEnabled() bool {
featuresInit()
Expand Down