From 1f766a5aaf1654ac79df6a92268f4fbd8b7cd767 Mon Sep 17 00:00:00 2001 From: Florent Revest Date: Fri, 16 Jan 2026 13:56:33 +0100 Subject: [PATCH 1/3] pkg/aflow/action/kernel/build: log build errors Currently, when the kernel build fails, syz-aflow prints something along the line of: failed to run ["make" "KERNELVERSION=syzkaller" "KERNELRELEASE=syzkaller" "LOCALVERSION=-syzkaller" "-j" "36" "ARCH=x86_64" "CC=ccache clang" "LD=ld.lld" "O=workdir/cache/build/1c6c481ef478edbb8bf3afb9d73e9ff157b1a204" "bzImage" "compile_commands.json"]: exit status 2 Which is not particularly helpful, especially because the build directory gets immediately wiped out and the source directory does not contain the extracted .config which makes reproduction especially annoying. The -s flag makes make "silent", meaning that it only prints errors and not all successfully built compilation units, which keeps the logs more concise. --- pkg/aflow/action/kernel/build.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/aflow/action/kernel/build.go b/pkg/aflow/action/kernel/build.go index a24f9359bade..46ed2ae95702 100644 --- a/pkg/aflow/action/kernel/build.go +++ b/pkg/aflow/action/kernel/build.go @@ -46,9 +46,9 @@ func buildKernel(ctx *aflow.Context, args buildArgs) (buildResult, error) { makeArgs := build.LinuxMakeArgs(target, targets.DefaultLLVMCompiler, targets.DefaultLLVMLinker, "ccache", dir, runtime.NumCPU()) compileCommnads := "compile_commands.json" - makeArgs = append(makeArgs, path.Base(image), compileCommnads) - if _, err := osutil.RunCmd(time.Hour, args.KernelSrc, "make", makeArgs...); err != nil { - return aflow.FlowError(err) + makeArgs = append(makeArgs, "-s", path.Base(image), compileCommnads) + if out, err := osutil.RunCmd(time.Hour, args.KernelSrc, "make", makeArgs...); err != nil { + return aflow.FlowError(fmt.Errorf("make failed: %w\n%s", err, out)) } // Remove main intermediate build files, we don't need them anymore // and they take lots of space. But keep generated source files. From ed8972cc4bb8769aa5944ccff47a2763bb5e7a02 Mon Sep 17 00:00:00 2001 From: Florent Revest Date: Fri, 16 Jan 2026 18:37:57 +0100 Subject: [PATCH 2/3] tools/syz-aflow: only print errors once at the end Currently, when an error occurs, it is printed as part of many Spans, in my experience 3 times: 2026/01/20 19:38:59 finished action crash-reproducer (1/4) in 1.570202281s results: CrashReport: error: reproducer did not crash 2026/01/20 19:38:59 finished flow patching (0/0) in 1.571440624s results: error: reproducer did not crash reproducer did not crash exit status 1 After this change it is only printed once: 2026/01/20 19:36:42 starting action crash-reproducer (1/4)... reproducer did not crash exit status 1 --- tools/syz-aflow/aflow.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/syz-aflow/aflow.go b/tools/syz-aflow/aflow.go index 160d4541c17d..20f4f4a4acbe 100644 --- a/tools/syz-aflow/aflow.go +++ b/tools/syz-aflow/aflow.go @@ -95,6 +95,11 @@ func run(ctx context.Context, model, flowName, inputFile, workdir string, cacheS } func onEvent(span *trajectory.Span) error { + if span.Error != "" { + // We do not want to print error twice (once here and once in main). + // So we ignore those events. + return nil + } log.Printf("%v", span) return nil } From cfa16482d180af7e089b30434a4af67f7455d940 Mon Sep 17 00:00:00 2001 From: Florent Revest Date: Tue, 20 Jan 2026 19:42:03 +0100 Subject: [PATCH 3/3] pkg/aflow/action/kernel/build: fix a typo While we are at it, let's also make it a constant to make the intent clearer. --- pkg/aflow/action/kernel/build.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/aflow/action/kernel/build.go b/pkg/aflow/action/kernel/build.go index 46ed2ae95702..575eec6be426 100644 --- a/pkg/aflow/action/kernel/build.go +++ b/pkg/aflow/action/kernel/build.go @@ -45,8 +45,8 @@ func buildKernel(ctx *aflow.Context, args buildArgs) (buildResult, error) { image := filepath.FromSlash(build.LinuxKernelImage(targets.AMD64)) makeArgs := build.LinuxMakeArgs(target, targets.DefaultLLVMCompiler, targets.DefaultLLVMLinker, "ccache", dir, runtime.NumCPU()) - compileCommnads := "compile_commands.json" - makeArgs = append(makeArgs, "-s", path.Base(image), compileCommnads) + const compileCommands = "compile_commands.json" + makeArgs = append(makeArgs, "-s", path.Base(image), compileCommands) if out, err := osutil.RunCmd(time.Hour, args.KernelSrc, "make", makeArgs...); err != nil { return aflow.FlowError(fmt.Errorf("make failed: %w\n%s", err, out)) } @@ -55,7 +55,7 @@ func buildKernel(ctx *aflow.Context, args buildArgs) (buildResult, error) { keepFiles := map[string]bool{ image: true, target.KernelObject: true, - compileCommnads: true, + compileCommands: true, } return filepath.WalkDir(dir, func(path string, d fs.DirEntry, err error) error { if err != nil {