Skip to content

Commit 3409d5c

Browse files
authored
Merge pull request #1606 from cyphar/rootfs-propagation-no-pivot
specconv: emit an error when using MS_PRIVATE with --no-pivot
2 parents 4edd9fb + d4f0f9a commit 3409d5c

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

libcontainer/specconv/spec_linux.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,9 @@ func CreateLibcontainerConfig(opts *CreateOpts) (*configs.Config, error) {
203203
if config.RootPropagation, exists = mountPropagationMapping[spec.Linux.RootfsPropagation]; !exists {
204204
return nil, fmt.Errorf("rootfsPropagation=%v is not supported", spec.Linux.RootfsPropagation)
205205
}
206+
if config.NoPivotRoot && (config.RootPropagation&unix.MS_PRIVATE != 0) {
207+
return nil, fmt.Errorf("rootfsPropagation of [r]private is not safe without pivot_root")
208+
}
206209

207210
for _, ns := range spec.Linux.Namespaces {
208211
t, exists := namespaceMapping[ns.Type]

0 commit comments

Comments
 (0)