diff options
| author | Liz Prucka <lizprucka@google.com> | 2024-03-11 14:46:19 -0500 |
|---|---|---|
| committer | kalder <61064868+kalder@users.noreply.github.com> | 2024-03-12 20:17:27 +0000 |
| commit | db5b7ff0c1508e1f6bc77ba4df578cabb88b9914 (patch) | |
| tree | 077ada5107e067707bc521f75cf70de1edd7ed93 /pkg/build/cuttlefish.go | |
| parent | c35c26ec6312219507c518bae2e56c1ea46a5f36 (diff) | |
build/cuttlefish: revert input config support
Supporting configs from syz-kconf has increased complexity in
reproducing builds, and not caused any quantifiable increase in
fuzzing efficacy or crashes.
Reverting the Cuttlefish build to use upstream build commands
to increase ease in reproduction.
Diffstat (limited to 'pkg/build/cuttlefish.go')
| -rw-r--r-- | pkg/build/cuttlefish.go | 42 |
1 files changed, 1 insertions, 41 deletions
diff --git a/pkg/build/cuttlefish.go b/pkg/build/cuttlefish.go index 377f14222..196090c1b 100644 --- a/pkg/build/cuttlefish.go +++ b/pkg/build/cuttlefish.go @@ -6,7 +6,6 @@ package build import ( "archive/tar" "compress/gzip" - "errors" "fmt" "io" "os" @@ -35,7 +34,7 @@ func (c cuttlefish) runBuild(kernelDir, buildConfig string) error { } func (c cuttlefish) runBazel(kernelDir string) error { - cmd := osutil.Command("tools/bazel", "run", bazelTarget, "--", "--dist_dir=dist") + cmd := osutil.Command("tools/bazel", "run", "--kasan", bazelTarget, "--", "--dist_dir=dist") if err := osutil.Sandbox(cmd, true, false); err != nil { return fmt.Errorf("failed to sandbox build command: %w", err) } @@ -44,39 +43,6 @@ func (c cuttlefish) runBazel(kernelDir string) error { return err } -func (c cuttlefish) createDefconfig(commonDir string, config []byte) error { - configFile := filepath.Join(commonDir, ".config") - if err := osutil.WriteFile(configFile, config); err != nil { - return fmt.Errorf("writing config failed: %w", err) - } - if err := osutil.SandboxChown(configFile); err != nil { - return fmt.Errorf("error changing config owner: %w", err) - } - - // Create a 'defconfig' file from full '.config'. - cmd := osutil.Command("make", "savedefconfig") - cmd.Dir = commonDir - if err := osutil.Sandbox(cmd, true, false); err != nil { - return fmt.Errorf("failed to sandbox defconfig creation: %w", err) - } - if _, err := osutil.Run(time.Hour, cmd); err != nil { - return fmt.Errorf("failed to create defconfig: %w", err) - } - - // Copy defconfig to expected config directory. - defconfigFile := filepath.Join(commonDir, "arch", "x86", "configs", "gki_defconfig") - if err := os.Rename(filepath.Join(commonDir, "defconfig"), defconfigFile); err != nil { - return fmt.Errorf("writing config failed: %w", err) - } - if err := osutil.SandboxChown(defconfigFile); err != nil { - return fmt.Errorf("error changing defconfig owner: %w", err) - } - if err := os.Remove(configFile); err != nil { - return fmt.Errorf("failure removing temp config: %w", err) - } - return nil -} - func (c cuttlefish) readCompiler(archivePath string) (string, error) { f, err := os.Open(archivePath) if err != nil { @@ -129,12 +95,6 @@ func (c cuttlefish) build(params Params) (ImageDetails, error) { } // Default to build.sh if compiler is not specified. if params.Compiler == "bazel" { - if params.Config == nil { - return details, errors.New("kernel config was not provided for build") - } - if err := c.createDefconfig(filepath.Join(params.KernelDir, "common"), params.Config); err != nil { - return details, fmt.Errorf("failed to create defconfig file: %w", err) - } if err := c.runBazel(params.KernelDir); err != nil { return details, fmt.Errorf("failed to build kernel: %w", err) } |
