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. --- pkg/csource/csource_test.go | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'pkg') diff --git a/pkg/csource/csource_test.go b/pkg/csource/csource_test.go index 1dae0202d..9e9dadf86 100644 --- a/pkg/csource/csource_test.go +++ b/pkg/csource/csource_test.go @@ -38,6 +38,10 @@ func TestGenerate(t *testing.T) { t.Parallel() checked := make(map[string]bool) for _, target := range prog.AllTargets() { + // Auto-generated descriptions currently do not properly mark arch-specific syscalls, see + // https://github.com/google/syzkaller/issues/5410#issuecomment-3570190241. + // Until it's fixed, let's remove these syscalls from csource tests. + ct := target.NoAutoChoiceTable() sysTarget := targets.Get(target.OS, target.Arch) if runtime.GOOS != sysTarget.BuildOS { continue @@ -50,14 +54,14 @@ func TestGenerate(t *testing.T) { if full || !testing.Short() { checked[target.OS] = true t.Parallel() - testTarget(t, target, full) + testTarget(t, target, full, ct) } - testPseudoSyscalls(t, target) + testPseudoSyscalls(t, target, ct) }) } } -func testPseudoSyscalls(t *testing.T, target *prog.Target) { +func testPseudoSyscalls(t *testing.T, target *prog.Target, ct *prog.ChoiceTable) { // Use options that are as minimal as possible. // We want to ensure that the code can always be compiled. opts := Options{ @@ -65,7 +69,7 @@ func testPseudoSyscalls(t *testing.T, target *prog.Target) { } rs := testutil.RandSource(t) for _, meta := range target.PseudoSyscalls() { - p := target.GenSampleProg(meta, rs) + p := target.GenSampleProg(meta, rs, ct) t.Run(fmt.Sprintf("single_%s", meta.CallName), func(t *testing.T) { t.Parallel() testOne(t, p, opts) @@ -73,9 +77,9 @@ func testPseudoSyscalls(t *testing.T, target *prog.Target) { } } -func testTarget(t *testing.T, target *prog.Target, full bool) { +func testTarget(t *testing.T, target *prog.Target, full bool, ct *prog.ChoiceTable) { rs := testutil.RandSource(t) - p := target.Generate(rs, 10, target.DefaultChoiceTable()) + p := target.Generate(rs, 10, ct) // Turns out that fully minimized program can trigger new interesting warnings, // e.g. about NULL arguments for functions that require non-NULL arguments in syz_ functions. // We could append both AllSyzProg as-is and a minimized version of it, -- cgit mrf-deployment