From be531bb42381b245eed805e49fd889d1c2118c76 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Wed, 27 Oct 2021 12:09:04 +0200 Subject: sys/syz-sysgen: restore detection of unsupported kvm syscalls The workaround for broken kvm kernel headers broke detection of unsupported syscalls. The diagnostic check checks that a syscall is unsupported on all arches, but arm/riscv kvm syscalls were not noted as unsupported (we dropped them before giving them to the compiler). As the result it looked like kvm syscalls are not unsupported on arm/riscv, and we did not produce the diagnostic. --- sys/syz-sysgen/sysgen.go | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'sys') diff --git a/sys/syz-sysgen/sysgen.go b/sys/syz-sysgen/sysgen.go index e4791b3eb..4099bfb51 100644 --- a/sys/syz-sysgen/sysgen.go +++ b/sys/syz-sysgen/sysgen.go @@ -176,8 +176,19 @@ func processJob(job *Job, descriptions *ast.Description, constFile *compiler.Con // is not supported yet but might be in the future. // Note: syz-extract also ignores this file for arm and riscv64. top = descriptions.Filter(func(n ast.Node) bool { - pos, _, _ := n.Info() - return !strings.HasSuffix(pos.File, "_kvm.txt") + pos, typ, name := n.Info() + if !strings.HasSuffix(pos.File, "_kvm.txt") { + return true + } + switch n.(type) { + case *ast.Resource, *ast.Struct, *ast.Call, *ast.TypeDef: + // Mimic what pkg/compiler would do with unsupported entries. + // This is required to keep the unsupported diagnostic below working + // for kvm entries, otherwise it will not think that kvm entries + // are not supported on all architectures. + job.Unsupported[typ+" "+name] = true + } + return false }) } if job.Target.OS == targets.TestOS { -- cgit mrf-deployment