diff options
Diffstat (limited to 'prog')
| -rw-r--r-- | prog/analysis.go | 4 | ||||
| -rw-r--r-- | prog/images_test.go | 5 | ||||
| -rw-r--r-- | prog/prog_test.go | 16 | ||||
| -rw-r--r-- | prog/types.go | 3 |
4 files changed, 24 insertions, 4 deletions
diff --git a/prog/analysis.go b/prog/analysis.go index 087a2b3dc..a6ad97c08 100644 --- a/prog/analysis.go +++ b/prog/analysis.go @@ -383,7 +383,7 @@ const ( MountInRepro AssetType = iota ) -func (p *Prog) ForEachAsset(cb func(name string, typ AssetType, r io.Reader)) { +func (p *Prog) ForEachAsset(cb func(name string, typ AssetType, r io.Reader, c *Call)) { for id, c := range p.Calls { ForeachArg(c, func(arg Arg, _ *ArgCtx) { a, ok := arg.(*DataArg) @@ -395,7 +395,7 @@ func (p *Prog) ForEachAsset(cb func(name string, typ AssetType, r io.Reader)) { if len(data) == 0 { return } - cb(fmt.Sprintf("mount_%v", id), MountInRepro, bytes.NewReader(data)) + cb(fmt.Sprintf("mount_%v", id), MountInRepro, bytes.NewReader(data), c) }) } } diff --git a/prog/images_test.go b/prog/images_test.go index 86914105f..1ae7008f9 100644 --- a/prog/images_test.go +++ b/prog/images_test.go @@ -46,10 +46,13 @@ func TestForEachAsset(t *testing.T) { t.Fatalf("failed to deserialize %s: %s", file, err) } base := strings.TrimSuffix(file, ".in") - p.ForEachAsset(func(name string, typ AssetType, r io.Reader) { + p.ForEachAsset(func(name string, typ AssetType, r io.Reader, c *Call) { if typ != MountInRepro { t.Fatalf("unknown asset type %v", typ) } + if !strings.HasPrefix(c.Meta.Name, "syz_mount_image$") { + t.Fatalf("unexpected syscall name %v", c.Meta.Name) + } testResult, err := io.ReadAll(r) if err != nil { t.Fatal(err) diff --git a/prog/prog_test.go b/prog/prog_test.go index 29f2aee5b..96280b3e8 100644 --- a/prog/prog_test.go +++ b/prog/prog_test.go @@ -140,6 +140,22 @@ func TestVmaType(t *testing.T) { } } +func TestFsckAttr(t *testing.T) { + target, err := GetTarget("test", "64") + if err != nil { + t.Fatal(err) + } + + syscall := target.SyscallMap["test$fsck_attr"] + if syscall == nil { + t.Fatal("could not find test$fsck_attr in sys/test") + } + + if syscall.Attrs.Fsck != "fsck.test -n" { + t.Fatalf("unexpected fsck command %s", syscall.Attrs.Fsck) + } +} + // TestCrossTarget ensures that a program serialized for one arch can be // deserialized for another arch. This happens when managers exchange // programs via hub. diff --git a/prog/types.go b/prog/types.go index 5f2360946..02bbdffdf 100644 --- a/prog/types.go +++ b/prog/types.go @@ -33,7 +33,7 @@ type Syscall struct { // pkg/compiler uses this structure to parse descriptions. // syz-sysgen uses this structure to generate code for executor. // -// Only `bool`s and `uint64`s are currently supported. +// Only `bool`s, `string`s and `uint64`s are currently supported. // // See docs/syscall_descriptions_syntax.md for description of individual attributes. type SyscallAttrs struct { @@ -47,6 +47,7 @@ type SyscallAttrs struct { RemoteCover bool Automatic bool AutomaticHelper bool + Fsck string } // MaxArgs is maximum number of syscall arguments. |
