Skip to content

Commit

Permalink
Merge pull request #202 from gustavosbarreto/unshare_mount
Browse files Browse the repository at this point in the history
updatehub: unshare mount namespace
  • Loading branch information
otavio committed May 29, 2018
2 parents 3285b46 + 8a40c76 commit bbff592
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions cmd/updatehub/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"os"
"path"
"path/filepath"
"syscall"

"github.com/pkg/errors"

Expand Down Expand Up @@ -77,6 +78,18 @@ func main() {
log.SetLevel(logrus.DebugLevel)
}

// enter in a new mount NS for isolating changes to the mount table
if err := syscall.Unshare(syscall.CLONE_NEWNS); err != nil {
log.Fatalf("failed to enter private mount NS: %s", err)
os.Exit(1)
}

err = syscall.Mount("", "/", "updatehub", syscall.MS_REC|syscall.MS_SLAVE, "")
if err != nil {
log.Fatalf("failed to mark rootfs as rslave: %s", err)
os.Exit(1)
}

osFs := afero.NewOsFs()
settings := &updatehub.Settings{}

Expand Down

0 comments on commit bbff592

Please sign in to comment.