Merge pull request #4829 from marquiz/devel/rdt-validate

libcontainer/configs/validate: check that intelrdt is enabled
This commit is contained in:
Rodrigo Campos
2025-08-05 16:12:51 -03:00
committed by GitHub
2 changed files with 10 additions and 0 deletions
@@ -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)
}
+6
View File
@@ -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()