Skip to content

Commit

Permalink
Use errors=remount-ro mount option with ext3 filesystems only
Browse files Browse the repository at this point in the history
  • Loading branch information
cclerget committed Nov 27, 2019
1 parent e33f028 commit 3f3136b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion internal/pkg/runtime/engine/imgbuild/create_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func (e *EngineOperations) CreateContainer(ctx context.Context, pid int, rpcConn
}

sylog.Debugf("Mounting image directory %s\n", rootfs)
if err := rpcOps.Mount(rootfs, sessionRootFs, "", syscall.MS_BIND, "errors=remount-ro"); err != nil {
if err := rpcOps.Mount(rootfs, sessionRootFs, "", syscall.MS_BIND, ""); err != nil {
return fmt.Errorf("failed to mount directory filesystem %s: %s", rootfs, err)
}

Expand Down
5 changes: 4 additions & 1 deletion internal/pkg/util/fs/mount/mount_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,10 @@ func (p *Points) AddImage(tag AuthorizedTag, source string, dest string, fstype
return fmt.Errorf("invalid image size, zero length")
}
keyB64 := base64.StdEncoding.EncodeToString(key)
options = fmt.Sprintf("loop,offset=%d,sizelimit=%d,key=%s,errors=remount-ro", offset, sizelimit, keyB64)
options = fmt.Sprintf("loop,offset=%d,sizelimit=%d,key=%s", offset, sizelimit, keyB64)
if fstype == "ext3" {
options += ",errors=remount-ro"
}
return p.add(tag, source, dest, fstype, flags, options)
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/ocibundle/sif/bundle_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func (s *sifBundle) Create(ociConfig *specs.Spec) error {
}

rootFs := tools.RootFs(s.bundlePath).Path()
if err := syscall.Mount(loop, rootFs, "squashfs", syscall.MS_RDONLY, "errors=remount-ro"); err != nil {
if err := syscall.Mount(loop, rootFs, "squashfs", syscall.MS_RDONLY, ""); err != nil {
tools.DeleteBundle(s.bundlePath)
return fmt.Errorf("failed to mount SIF partition: %s", err)
}
Expand Down

0 comments on commit 3f3136b

Please sign in to comment.