From 26be8df8135ecb59e8034967927aa18c26117a3a Mon Sep 17 00:00:00 2001 From: Taras Madan Date: Wed, 22 Feb 2023 16:09:15 +0100 Subject: all: tools/syz-env make generate result --- pkg/csource/csource.go | 34 +++++++++++++++++----------------- pkg/email/parser_test.go | 4 ++-- pkg/kconfig/config.go | 2 +- pkg/log/log.go | 8 ++++---- pkg/tool/tool.go | 7 ++++--- 5 files changed, 28 insertions(+), 27 deletions(-) (limited to 'pkg') diff --git a/pkg/csource/csource.go b/pkg/csource/csource.go index 8671a57db..d4972261b 100644 --- a/pkg/csource/csource.go +++ b/pkg/csource/csource.go @@ -4,23 +4,23 @@ // Package csource generates [almost] equivalent C programs from syzkaller programs. // // Outline of the process: -// - inputs to the generation are the program and options -// - options control multiple aspects of the resulting C program, -// like if we want a multi-threaded program or a single-threaded, -// what type of sandbox we want to use, if we want to setup net devices or not, etc -// - we use actual executor sources as the base -// - gen.go takes all executor/common*.h headers and bundles them into generated.go -// - during generation we tear executor headers apart and take only the bits -// we need for the current program/options, this is done by running C preprocessor -// with particular set of defines so that the preprocessor removes unneeded -// #ifdef SYZ_FOO sections -// - then we generate actual syscall calls with the given arguments -// based on the binary "encodingexec" representation of the program -// (the same representation executor uses for interpretation) -// - then we glue it all together -// - as the last step we run some text post-processing on the resulting source code: -// remove debug calls, replace exitf/fail with exit, hoist/sort/dedup includes, -// remove duplicate empty lines, etc +// - inputs to the generation are the program and options +// - options control multiple aspects of the resulting C program, +// like if we want a multi-threaded program or a single-threaded, +// what type of sandbox we want to use, if we want to setup net devices or not, etc +// - we use actual executor sources as the base +// - gen.go takes all executor/common*.h headers and bundles them into generated.go +// - during generation we tear executor headers apart and take only the bits +// we need for the current program/options, this is done by running C preprocessor +// with particular set of defines so that the preprocessor removes unneeded +// #ifdef SYZ_FOO sections +// - then we generate actual syscall calls with the given arguments +// based on the binary "encodingexec" representation of the program +// (the same representation executor uses for interpretation) +// - then we glue it all together +// - as the last step we run some text post-processing on the resulting source code: +// remove debug calls, replace exitf/fail with exit, hoist/sort/dedup includes, +// remove duplicate empty lines, etc package csource import ( diff --git a/pkg/email/parser_test.go b/pkg/email/parser_test.go index edeb4a8de..b6eb58257 100644 --- a/pkg/email/parser_test.go +++ b/pkg/email/parser_test.go @@ -159,8 +159,8 @@ line1 #syz fix bar baz line 2 `, - cmd: CmdFix, - str: "fix", + cmd: CmdFix, + str: "fix", args: "bar baz", }, { diff --git a/pkg/kconfig/config.go b/pkg/kconfig/config.go index a9c571b1d..4a917df28 100644 --- a/pkg/kconfig/config.go +++ b/pkg/kconfig/config.go @@ -36,7 +36,7 @@ const ( prefix = "CONFIG_" ) -// Value returns config value, or No if it's not present at all. +// Value returns config value, or No if it's not present at all. func (cf *ConfigFile) Value(name string) string { cfg := cf.Map[name] if cfg == nil { diff --git a/pkg/log/log.go b/pkg/log/log.go index 92063f6de..935b0d1cd 100644 --- a/pkg/log/log.go +++ b/pkg/log/log.go @@ -2,10 +2,10 @@ // Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. // Package log provides functionality similar to standard log package with some extensions: -// - verbosity levels -// - global verbosity setting that can be used by multiple packages -// - ability to disable all output -// - ability to cache recent output in memory +// - verbosity levels +// - global verbosity setting that can be used by multiple packages +// - ability to disable all output +// - ability to cache recent output in memory package log import ( diff --git a/pkg/tool/tool.go b/pkg/tool/tool.go index 690bfa4b8..0221cb876 100644 --- a/pkg/tool/tool.go +++ b/pkg/tool/tool.go @@ -11,9 +11,10 @@ import ( ) // Init handles common tasks for command line tools: -// - invokes flag.Parse -// - adds support for optional flags (see OptionalFlags) -// - adds support for cpu/mem profiling (-cpuprofile/memprofile flags) +// - invokes flag.Parse +// - adds support for optional flags (see OptionalFlags) +// - adds support for cpu/mem profiling (-cpuprofile/memprofile flags) +// // Use as defer tool.Init()(). func Init() func() { flagCPUProfile := flag.String("cpuprofile", "", "write CPU profile to this file") -- cgit mrf-deployment