diff options
| author | Aleksandr Nogikh <nogikh@google.com> | 2025-11-24 12:25:46 +0100 |
|---|---|---|
| committer | Aleksandr Nogikh <nogikh@google.com> | 2025-11-24 14:34:18 +0000 |
| commit | 8f574c3487990421d80fb1a248f5d9f8b27654bb (patch) | |
| tree | 0bb7ee3207c989294782d713324d135724648c7c /prog | |
| parent | bf6fe8fef08f3e0d8c066121c66eaf37681e0de9 (diff) | |
pkg/csource: exclude auto-generated syscalls from tests
Auto-generated syscall descriptions currently do not properly mark
arch-specific syscalls like socketcall (which is only available on 32
bit systems), which leads to TestGenerate breakages.
Until the syz-declextract tool is fixed and descriptions are
re-generated, don't use such calls in TestGenerate tests. It has
recently caused numerous syzkaller update erorrs on syzbot.
Cc #5410.
Closes #6468.
Diffstat (limited to 'prog')
| -rw-r--r-- | prog/rand.go | 4 | ||||
| -rw-r--r-- | prog/target.go | 11 |
2 files changed, 13 insertions, 2 deletions
diff --git a/prog/rand.go b/prog/rand.go index d54ef0dfe..834003914 100644 --- a/prog/rand.go +++ b/prog/rand.go @@ -670,9 +670,9 @@ func (target *Target) PseudoSyscalls() []*Syscall { } // GenSampleProg generates a single sample program for the call. -func (target *Target) GenSampleProg(meta *Syscall, rs rand.Source) *Prog { +func (target *Target) GenSampleProg(meta *Syscall, rs rand.Source, ct *ChoiceTable) *Prog { r := newRand(target, rs) - s := newState(target, target.DefaultChoiceTable(), nil) + s := newState(target, ct, nil) p := &Prog{ Target: target, } diff --git a/prog/target.go b/prog/target.go index 300a86a32..b5d198f27 100644 --- a/prog/target.go +++ b/prog/target.go @@ -370,6 +370,17 @@ func (target *Target) DefaultChoiceTable() *ChoiceTable { return target.defaultChoiceTable } +func (target *Target) NoAutoChoiceTable() *ChoiceTable { + calls := map[*Syscall]bool{} + for _, c := range target.Syscalls { + if c.Attrs.Automatic { + continue + } + calls[c] = true + } + return target.BuildChoiceTable(nil, calls) +} + func (target *Target) RequiredGlobs() []string { globs := make(map[string]bool) ForeachType(target.Syscalls, func(typ Type, ctx *TypeCtx) { |
