From 8f574c3487990421d80fb1a248f5d9f8b27654bb Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Mon, 24 Nov 2025 12:25:46 +0100 Subject: 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. --- prog/rand.go | 4 ++-- prog/target.go | 11 +++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) (limited to 'prog') 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) { -- cgit mrf-deployment