mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
Merge pull request #2398 from pkagrawal/master
Honor spec.Process.NoNewPrivileges in specconv.CreateLibcontainerConfig
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user