diff options
author | Chong Cai <chongc@google.com> | 2021-03-23 11:04:08 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-03-23 11:06:02 -0700 |
commit | beb11cec7669d029172751e5b4dfe21c0672a25a (patch) | |
tree | 27fad88ce84075d91830aba0069442c2f6ad3efd /runsc/fsgofer/fsgofer_test.go | |
parent | dc75f08c2ade0c52af190a33766ecc522237e682 (diff) |
Allow FSETXATTR/FGETXATTR host calls for Verity
These host calls are needed for Verity fs to generate/verify hashes.
PiperOrigin-RevId: 364598180
Diffstat (limited to 'runsc/fsgofer/fsgofer_test.go')
-rw-r--r-- | runsc/fsgofer/fsgofer_test.go | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/runsc/fsgofer/fsgofer_test.go b/runsc/fsgofer/fsgofer_test.go index a5f09f88f..d7e141476 100644 --- a/runsc/fsgofer/fsgofer_test.go +++ b/runsc/fsgofer/fsgofer_test.go @@ -579,20 +579,24 @@ func SetGetXattr(l *localFile, name string, value string) error { return nil } +func TestSetGetDisabledXattr(t *testing.T) { + runCustom(t, []uint32{unix.S_IFREG}, rwConfs, func(t *testing.T, s state) { + name := "user.merkle.offset" + value := "tmp" + err := SetGetXattr(s.file, name, value) + if err == nil { + t.Fatalf("%v: SetGetXattr should have failed", s) + } + }) +} + func TestSetGetXattr(t *testing.T) { - xattrConfs := []Config{{ROMount: false, EnableXattr: false}, {ROMount: false, EnableXattr: true}} - runCustom(t, []uint32{unix.S_IFREG}, xattrConfs, func(t *testing.T, s state) { - name := "user.test" + runCustom(t, []uint32{unix.S_IFREG}, []Config{{ROMount: false, EnableVerityXattr: true}}, func(t *testing.T, s state) { + name := "user.merkle.offset" value := "tmp" err := SetGetXattr(s.file, name, value) - if s.conf.EnableXattr { - if err != nil { - t.Fatalf("%v: SetGetXattr failed, err: %v", s, err) - } - } else { - if err == nil { - t.Fatalf("%v: SetGetXattr should have failed", s) - } + if err != nil { + t.Fatalf("%v: SetGetXattr failed, err: %v", s, err) } }) } |