Merge pull request #2398 from pkagrawal/master

Honor spec.Process.NoNewPrivileges in specconv.CreateLibcontainerConfig
This commit is contained in:
Akihiro Suda
2020-05-12 15:05:55 +09:00
committed by GitHub
2 changed files with 6 additions and 0 deletions
+1
View File
@@ -260,6 +260,7 @@ func CreateLibcontainerConfig(opts *CreateOpts) (*configs.Config, error) {
}
if spec.Process != nil {
config.OomScoreAdj = spec.Process.OOMScoreAdj
config.NoNewPrivileges = spec.Process.NoNewPrivileges
if spec.Process.SelinuxLabel != "" {
config.ProcessLabel = spec.Process.SelinuxLabel
}
+5
View File
@@ -391,6 +391,11 @@ func TestSpecconvExampleValidate(t *testing.T) {
t.Errorf("Couldn't create libcontainer config: %v", err)
}
if config.NoNewPrivileges != spec.Process.NoNewPrivileges {
t.Errorf("specconv NoNewPrivileges mismatch. Expected %v got %v",
spec.Process.NoNewPrivileges, config.NoNewPrivileges)
}
validator := validate.New()
if err := validator.Validate(config); err != nil {
t.Errorf("Expected specconv to produce valid container config: %v", err)