diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2026-03-05 16:19:10 +0100 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2026-03-05 19:54:06 +0000 |
| commit | 6dc90bbb492fd93da310988ae3a0ea44b8dc40db (patch) | |
| tree | 654e28e0f8422cb0e7429e167b6d56952e3b825b /pkg | |
| parent | b31d884d1ac0e8242c5e81e1937cc300b1073c3d (diff) | |
pkg/aflow/tool/syzlang: provide list of description files
Update #6878
Diffstat (limited to 'pkg')
| -rw-r--r-- | pkg/aflow/action.go | 6 | ||||
| -rw-r--r-- | pkg/aflow/flow/repro/repro.go | 6 | ||||
| -rw-r--r-- | pkg/aflow/tool/syzlang/descriptions.go | 21 | ||||
| -rw-r--r-- | pkg/aflow/tool/syzlang/descriptions_test.go | 16 |
4 files changed, 49 insertions, 0 deletions
diff --git a/pkg/aflow/action.go b/pkg/aflow/action.go index 741758845..2e6f8a0d0 100644 --- a/pkg/aflow/action.go +++ b/pkg/aflow/action.go @@ -35,3 +35,9 @@ func (p *pipeline) verify(ctx *verifyContext) { a.verify(ctx) } } + +func Provide[T any](value T) Action { + return NewFuncAction("provide-var", func(*Context, struct{}) (T, error) { + return value, nil + }) +} diff --git a/pkg/aflow/flow/repro/repro.go b/pkg/aflow/flow/repro/repro.go index a8aba30f6..ea2fd7955 100644 --- a/pkg/aflow/flow/repro/repro.go +++ b/pkg/aflow/flow/repro/repro.go @@ -7,6 +7,7 @@ import ( "github.com/google/syzkaller/pkg/aflow" "github.com/google/syzkaller/pkg/aflow/action/kernel" "github.com/google/syzkaller/pkg/aflow/ai" + "github.com/google/syzkaller/pkg/aflow/tool/syzlang" ) type ReproInputs struct { @@ -25,6 +26,7 @@ func init() { "reproduce a kernel crash and generate a syzlang program", &aflow.Flow{ Root: aflow.Pipeline( + aflow.Provide(struct{ DescriptionFiles []string }{syzlang.DescriptionFiles()}), kernel.Checkout, kernel.Build, &aflow.LLMAgent{ @@ -55,4 +57,8 @@ Bug Title: {{.BugTitle}} Original Crash Report: {{.CrashReport}} + +The list of existing description files: +{{range $file := .DescriptionFiles}}{{$file}} +{{end}} ` diff --git a/pkg/aflow/tool/syzlang/descriptions.go b/pkg/aflow/tool/syzlang/descriptions.go new file mode 100644 index 000000000..9af410c3c --- /dev/null +++ b/pkg/aflow/tool/syzlang/descriptions.go @@ -0,0 +1,21 @@ +// Copyright 2026 syzkaller project authors. All rights reserved. +// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. + +package syzlang + +import ( + "github.com/google/syzkaller/sys" + "github.com/google/syzkaller/sys/targets" +) + +func DescriptionFiles() []string { + entries, err := sys.Files.ReadDir(targets.Linux) + if err != nil { + panic(err) + } + var files []string + for _, ent := range entries { + files = append(files, ent.Name()) + } + return files +} diff --git a/pkg/aflow/tool/syzlang/descriptions_test.go b/pkg/aflow/tool/syzlang/descriptions_test.go new file mode 100644 index 000000000..23ca890e2 --- /dev/null +++ b/pkg/aflow/tool/syzlang/descriptions_test.go @@ -0,0 +1,16 @@ +// Copyright 2026 syzkaller project authors. All rights reserved. +// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. + +package syzlang + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func TestDescriptionFiles(t *testing.T) { + files := DescriptionFiles() + require.Greater(t, len(files), 50) + require.Contains(t, files, "sys.txt") +} |
