Skip to content

Commit 59daf73

Browse files
committed
tpm: move createVTPMs to point after init of config.Namespaces
Move the call to createVTPMs() to a point after the config.Namespaces has been initialized. Move the Cgroup creation after the createVTPMs() call, otherwise the Cgroup entries for the /dev/tpm* devices will not be there. Signed-off-by: Stefan Berger <[email protected]>
1 parent f2a0af1 commit 59daf73

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

libcontainer/specconv/spec_linux.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -194,14 +194,6 @@ func CreateLibcontainerConfig(opts *CreateOpts) (*configs.Config, error) {
194194
if err := setupUserNamespace(spec, config); err != nil {
195195
return nil, err
196196
}
197-
if err := createVTPMs(spec, config); err != nil {
198-
return nil, err
199-
}
200-
c, err := createCgroupConfig(opts)
201-
if err != nil {
202-
return nil, err
203-
}
204-
config.Cgroups = c
205197
// set linux-specific config
206198
if spec.Linux != nil {
207199
if config.RootPropagation, exists = mountPropagationMapping[spec.Linux.RootfsPropagation]; !exists {
@@ -237,6 +229,14 @@ func CreateLibcontainerConfig(opts *CreateOpts) (*configs.Config, error) {
237229
config.Seccomp = seccomp
238230
}
239231
}
232+
if err := createVTPMs(spec, config); err != nil {
233+
return nil, err
234+
}
235+
c, err := createCgroupConfig(opts)
236+
if err != nil {
237+
return nil, err
238+
}
239+
config.Cgroups = c
240240
if spec.Process.SelinuxLabel != "" {
241241
config.ProcessLabel = spec.Process.SelinuxLabel
242242
}

0 commit comments

Comments
 (0)