Don't log "ignored xattr ..." warnings

It is too noisy and not really useful if the input is random.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
This commit is contained in:
Kazuyoshi Kato 2022-06-15 19:02:33 +00:00
parent 112497bc36
commit 50f1a4e426

View File

@ -22,15 +22,25 @@ import (
"os" "os"
fuzz "github.com/AdaLogics/go-fuzz-headers" fuzz "github.com/AdaLogics/go-fuzz-headers"
"github.com/sirupsen/logrus"
"github.com/containerd/containerd/archive" "github.com/containerd/containerd/archive"
"github.com/containerd/containerd/content/local" "github.com/containerd/containerd/content/local"
imageArchive "github.com/containerd/containerd/images/archive" imageArchive "github.com/containerd/containerd/images/archive"
"github.com/containerd/containerd/log"
) )
// FuzzApply implements a fuzzer that applies // FuzzApply implements a fuzzer that applies
// a fuzzed tar archive on a directory // a fuzzed tar archive on a directory
func FuzzApply(data []byte) int { func FuzzApply(data []byte) int {
ctx := context.Background()
// Apply() is logging the below message, which is too noisy and not really useful
// if the input is random.
//
// level=warning msg="ignored xattr ... in archive" error="operation not supported"
log.G(ctx).Logger.SetLevel(logrus.PanicLevel)
f := fuzz.NewConsumer(data) f := fuzz.NewConsumer(data)
iters, err := f.GetInt() iters, err := f.GetInt()
if err != nil { if err != nil {
@ -48,7 +58,7 @@ func FuzzApply(data []byte) int {
return 0 return 0
} }
r := bytes.NewReader(rBytes) r := bytes.NewReader(rBytes)
_, _ = archive.Apply(context.Background(), tmpDir, r) _, _ = archive.Apply(ctx, tmpDir, r)
} }
return 1 return 1
} }