diff options
author | Zhaozhong Ni <nzz@google.com> | 2018-08-22 13:18:21 -0700 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2018-08-22 13:19:16 -0700 |
commit | 6b9133ba96863e3653fa6f3949710203bb077c50 (patch) | |
tree | c0aec36a715022a77f391fcc21fade70cbf9ec1a /pkg/sentry/fs | |
parent | 545ea7ab3fa3e976120b74da3271dc7724c05f5e (diff) |
sentry: mark S/R stating errors as save rejections / fs corruptions.
PiperOrigin-RevId: 209817767
Change-Id: Iddf2b8441bc44f31f9a8cf6f2bd8e7a5b824b487
Diffstat (limited to 'pkg/sentry/fs')
-rw-r--r-- | pkg/sentry/fs/gofer/inode_state.go | 6 | ||||
-rw-r--r-- | pkg/sentry/fs/host/inode_state.go | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/pkg/sentry/fs/gofer/inode_state.go b/pkg/sentry/fs/gofer/inode_state.go index 4f2b01c72..ad11034f9 100644 --- a/pkg/sentry/fs/gofer/inode_state.go +++ b/pkg/sentry/fs/gofer/inode_state.go @@ -67,7 +67,7 @@ func (i *inodeFileState) beforeSave() { if i.sattr.Type == fs.RegularFile { uattr, err := i.unstableAttr(&dummyClockContext{context.Background()}) if err != nil { - panic(fmt.Sprintf("failed to get unstable atttribute of %s: %v", i.s.inodeMappings[i.sattr.InodeID], err)) + panic(fs.ErrSaveRejection{fmt.Errorf("failed to get unstable atttribute of %s: %v", i.s.inodeMappings[i.sattr.InodeID], err)}) } i.savedUAttr = &uattr } @@ -128,7 +128,7 @@ func (i *inodeFileState) afterLoad() { _, i.file, err = i.s.attach.walk(ctx, splitAbsolutePath(name)) if err != nil { - return fmt.Errorf("failed to walk to %q: %v", name, err) + return fs.ErrCorruption{fmt.Errorf("failed to walk to %q: %v", name, err)} } // Remap the saved inode number into the gofer device using the @@ -136,7 +136,7 @@ func (i *inodeFileState) afterLoad() { // environment. qid, mask, attrs, err := i.file.getAttr(ctx, p9.AttrMaskAll()) if err != nil { - return fmt.Errorf("failed to get file attributes of %s: %v", name, err) + return fs.ErrCorruption{fmt.Errorf("failed to get file attributes of %s: %v", name, err)} } if !mask.RDev { return fs.ErrCorruption{fmt.Errorf("file %s lacks device", name)} diff --git a/pkg/sentry/fs/host/inode_state.go b/pkg/sentry/fs/host/inode_state.go index 135c75fd5..8bc99d94b 100644 --- a/pkg/sentry/fs/host/inode_state.go +++ b/pkg/sentry/fs/host/inode_state.go @@ -31,7 +31,7 @@ func (i *inodeFileState) beforeSave() { if !i.descriptor.donated && i.sattr.Type == fs.RegularFile { uattr, err := i.unstableAttr(context.Background()) if err != nil { - panic(fmt.Sprintf("failed to get unstable atttribute of %s: %v", i.mops.inodeMappings[i.sattr.InodeID], err)) + panic(fs.ErrSaveRejection{fmt.Errorf("failed to get unstable atttribute of %s: %v", i.mops.inodeMappings[i.sattr.InodeID], err)}) } i.savedUAttr = &uattr } @@ -47,7 +47,7 @@ func (i *inodeFileState) afterLoad() { // Remap the inode number. var s syscall.Stat_t if err := syscall.Fstat(i.FD(), &s); err != nil { - panic(fmt.Sprintf("failed to get metadata for fd %d: %v", i.FD(), err)) + panic(fs.ErrCorruption{fmt.Errorf("failed to get metadata for fd %d: %v", i.FD(), err)}) } key := device.MultiDeviceKey{ Device: s.Dev, |