From b436ffb77df158d69b51c39bb3bc480415118368 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Mon, 18 Nov 2019 17:39:09 +0100 Subject: pkg/build: produce more deterministic linux binaries There are few more dynamic variables related to kernel release tagging. Set these to known deterministic values. --- pkg/build/linux.go | 5 ++++- pkg/vcs/linux.go | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'pkg') diff --git a/pkg/build/linux.go b/pkg/build/linux.go index a74f056c0..6f49466b6 100644 --- a/pkg/build/linux.go +++ b/pkg/build/linux.go @@ -133,12 +133,15 @@ func runMake(kernelDir string, args ...string) error { cmd.Env = append([]string{}, os.Environ()...) // This makes the build [more] deterministic: // 2 builds from the same sources should result in the same vmlinux binary. - // We plan to use it for detecting no-op changes during bisection. + // Build on a release commit and on the previous one should result in the same vmlinux too. + // We use it for detecting no-op changes during bisection. cmd.Env = append(cmd.Env, "KBUILD_BUILD_VERSION=0", "KBUILD_BUILD_TIMESTAMP=now", "KBUILD_BUILD_USER=syzkaller", "KBUILD_BUILD_HOST=syzkaller", + "KERNELVERSION=syzkaller", + "LOCALVERSION=-syzkaller", ) _, err := osutil.Run(time.Hour, cmd) return err diff --git a/pkg/vcs/linux.go b/pkg/vcs/linux.go index b14b75280..c07c6aeaa 100644 --- a/pkg/vcs/linux.go +++ b/pkg/vcs/linux.go @@ -154,6 +154,8 @@ func linuxDisableConfigs(config []byte, tags map[string]bool) []byte { // Second, at 6689da155bdcd17abfe4d3a8b1e245d9ed4b5f2c CONFIG_KCOV selects CONFIG_GCC_PLUGIN_SANCOV // (why?), which is build broken for hundreds of revisions. "CONFIG_KCOV": "disable-always", + // This helps to produce stable binaries in presence of kernel tag changes. + "CONFIG_LOCALVERSION_AUTO": "disable-always", } for cfg, tag := range prereq { if !tags[tag] { -- cgit mrf-deployment