aboutsummaryrefslogtreecommitdiffstats
path: root/pkg
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2020-05-09 09:57:51 +0200
committerDmitry Vyukov <dvyukov@google.com>2020-05-09 09:57:51 +0200
commit65a44e22ba217ef7272b9d3735e9d12cfaa204f6 (patch)
tree3b88984491a6ca26a688c31adaf7e80134e3a30f /pkg
parente8d62d0c21fa78504c492a1418b84cb2477e06fa (diff)
pkg/build: find maintainers for build errors
Extract build error source file and obtain maintainers so that we can mail the report to the right people. Update #1667
Diffstat (limited to 'pkg')
-rw-r--r--pkg/bisect/bisect.go4
-rw-r--r--pkg/build/build.go71
-rw-r--r--pkg/build/build_test.go236
-rw-r--r--pkg/report/linux.go12
4 files changed, 300 insertions, 23 deletions
diff --git a/pkg/bisect/bisect.go b/pkg/bisect/bisect.go
index 84756cb56..1ea8a9738 100644
--- a/pkg/bisect/bisect.go
+++ b/pkg/bisect/bisect.go
@@ -380,8 +380,8 @@ func (env *env) test() (*testResult, error) {
if verr, ok := err.(*osutil.VerboseError); ok {
env.log("%v", verr.Title)
env.saveDebugFile(current.Hash, 0, verr.Output)
- } else if verr, ok := err.(build.KernelBuildError); ok {
- env.log("%v", verr.Title)
+ } else if verr, ok := err.(*build.KernelError); ok {
+ env.log("%s", verr.Report)
env.saveDebugFile(current.Hash, 0, verr.Output)
} else {
env.log("%v", err)
diff --git a/pkg/build/build.go b/pkg/build/build.go
index 37071fc7c..d9f7a7713 100644
--- a/pkg/build/build.go
+++ b/pkg/build/build.go
@@ -8,10 +8,12 @@ import (
"bytes"
"fmt"
"path/filepath"
+ "regexp"
"strings"
"time"
"github.com/google/syzkaller/pkg/osutil"
+ "github.com/google/syzkaller/pkg/report"
)
// Params is input arguments for the Image function.
@@ -61,7 +63,7 @@ func Image(params *Params) (string, error) {
}
err = builder.build(params)
if err != nil {
- return "", extractRootCause(err)
+ return "", extractRootCause(err, params.TargetOS, params.KernelDir)
}
sign := ""
if signer, ok := builder.(signer); ok {
@@ -81,8 +83,15 @@ func Clean(targetOS, targetArch, vmType, kernelDir string) error {
return builder.clean(kernelDir, targetArch)
}
-type KernelBuildError struct {
- *osutil.VerboseError
+type KernelError struct {
+ Report []byte
+ Output []byte
+ Maintainers []string
+ guiltyFile string
+}
+
+func (err *KernelError) Error() string {
+ return string(err.Report)
}
type builder interface {
@@ -158,7 +167,7 @@ func CompilerIdentity(compiler string) (string, error) {
return "", fmt.Errorf("no output from compiler --version")
}
-func extractRootCause(err error) error {
+func extractRootCause(err error, OS, kernelSrc string) error {
if err == nil {
return nil
}
@@ -166,25 +175,63 @@ func extractRootCause(err error) error {
if !ok {
return err
}
- cause := extractCauseInner(verr.Output)
- if cause != "" {
- verr.Title = cause
+ reason, file := extractCauseInner(verr.Output, kernelSrc)
+ if len(reason) == 0 {
+ return err
+ }
+ kernelErr := &KernelError{
+ Report: reason,
+ Output: verr.Output,
+ guiltyFile: file,
}
- return KernelBuildError{verr}
+ if file != "" && OS == "linux" {
+ maintainers, err := report.GetLinuxMaintainers(kernelSrc, file)
+ if err != nil {
+ kernelErr.Output = append(kernelErr.Output, err.Error()...)
+ }
+ kernelErr.Maintainers = maintainers
+ }
+ return kernelErr
}
-func extractCauseInner(s []byte) string {
+func extractCauseInner(s []byte, kernelSrc string) ([]byte, string) {
lines := extractCauseRaw(s)
- const maxLines = 10
+ const maxLines = 20
if len(lines) > maxLines {
lines = lines[:maxLines]
}
+ var stripPrefix []byte
+ if kernelSrc != "" {
+ stripPrefix = []byte(kernelSrc)
+ if stripPrefix[len(stripPrefix)-1] != filepath.Separator {
+ stripPrefix = append(stripPrefix, filepath.Separator)
+ }
+ }
+ file := ""
+ for i := range lines {
+ if stripPrefix != nil {
+ lines[i] = bytes.Replace(lines[i], stripPrefix, nil, -1)
+ }
+ if file == "" {
+ match := fileRe.FindSubmatch(lines[i])
+ if match != nil {
+ file = string(match[1])
+ if file[0] == '/' {
+ // We already removed kernel source prefix,
+ // if we still have an absolute path, it's probably pointing
+ // to compiler/system libraries (not going to work).
+ file = ""
+ }
+ }
+ }
+ }
+ file = strings.TrimPrefix(file, "./")
res := bytes.Join(lines, []byte{'\n'})
// gcc uses these weird quotes around identifiers, which may be
// mis-rendered by systems that don't understand utf-8.
res = bytes.Replace(res, []byte("‘"), []byte{'\''}, -1)
res = bytes.Replace(res, []byte("’"), []byte{'\''}, -1)
- return string(res)
+ return res, file
}
func extractCauseRaw(s []byte) [][]byte {
@@ -229,3 +276,5 @@ var buildFailureCauses = [...]buildFailureCause{
{weak: true, pattern: []byte("collect2: error: ")},
{weak: true, pattern: []byte("FAILED: Build did NOT complete")},
}
+
+var fileRe = regexp.MustCompile(`^([a-zA-Z0-9_\-/.]+):[0-9]+:([0-9]+:)? `)
diff --git a/pkg/build/build_test.go b/pkg/build/build_test.go
index 57fdffbc4..e9987ead1 100644
--- a/pkg/build/build_test.go
+++ b/pkg/build/build_test.go
@@ -4,6 +4,7 @@
package build
import (
+ "fmt"
"os/exec"
"strings"
"testing"
@@ -37,7 +38,7 @@ func TestCompilerIdentity(t *testing.T) {
func TestExtractRootCause(t *testing.T) {
// nolint: lll
- for _, s := range []struct{ e, expect string }{
+ for i, test := range []struct{ e, reason, src, file string }{
{`
LINK /home/dvyukov/src/linux2/tools/objtool/objtool
MKELF scripts/mod/elfconfig.h
@@ -50,7 +51,10 @@ func TestExtractRootCause(t *testing.T) {
CC arch/x86/kernel/asm-offsets.s
UPD include/generated/asm-offsets.h
CALL scripts/checksyscalls.sh
-`, "",
+`,
+ "",
+ "",
+ "",
},
{`
cc -g -Werror db_break.c
@@ -64,6 +68,8 @@ int kcov_cold = 1;
1 error generated.
`,
"sys/dev/kcov.c:93:6: error: use of undeclared identifier 'kcov_cold123'; did you mean 'kcov_cold'?",
+ "",
+ "sys/dev/kcov.c",
},
{`
CC /tools/objtool/parse-options.o
@@ -78,6 +84,8 @@ make: *** Waiting for unfinished jobs....
UPD include/config/kernel.release
`,
"/gcc-5.5.0/bin/../lib/gcc/x86_64-unknown-linux-gnu/5.5.0/plugin/include/builtins.h:23:17: fatal error: mpc.h: No such file or directory",
+ "",
+ "",
},
{`
Starting local Bazel server and connecting to it...
@@ -98,6 +106,8 @@ FAILED: Build did NOT complete successfully (189 packages loaded)
`ERROR: /kernel/vdso/BUILD:13:1: no such target '@bazel_tools//tools/cpp:cc_flags': target 'cc_flags' not declared in package 'tools/cpp' defined by /syzkaller/home/.cache/bazel/_bazel_root/e1c9d86bae2b34f90e83d224bc900958/external/bazel_tools/tools/cpp/BUILD and referenced by '//vdso:vdso'
ERROR: Analysis of target '//runsc:runsc' failed; build aborted: Analysis failed
FAILED: Build did NOT complete successfully (189 packages loaded)`,
+ "",
+ "",
},
{`
ld -T ld.script -X --warn-common -nopie -o bsd ${SYSTEM_HEAD} vers.o ${OBJS}
@@ -118,6 +128,8 @@ ld: error: too many errors emitted, stopping now (use -error-limit=0 to see all
`,
`ld: error: undefined symbol: __stack_smash_handler
ld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)`,
+ "",
+ "",
},
{`
make: execvp: /gcc-5.5.0/bin/gcc: Permission denied
@@ -152,6 +164,8 @@ make: *** Waiting for unfinished jobs....
`make: execvp: /gcc-5.5.0/bin/gcc: Permission denied
scripts/xen-hypercalls.sh: line 7: /gcc-5.5.0/bin/gcc: Permission denied
/bin/sh: 1: /gcc-5.5.0/bin/gcc: Permission denied`,
+ "",
+ "",
},
{`
./arch/x86/include/asm/nospec-branch.h:360:1: warning: data definition has no type or storage class
@@ -175,11 +189,221 @@ make: *** [prepare0] Error 2
`, `./arch/x86/include/asm/nospec-branch.h:360:1: error: type defaults to 'int' in declaration of 'DECLARE_STATIC_KEY_FALSE' [-Werror=implicit-int]
./arch/x86/include/asm/nospec-branch.h:394:6: error: implicit declaration of function 'static_branch_likely' [-Werror=implicit-function-declaration]
./arch/x86/include/asm/nospec-branch.h:394:28: error: 'mds_user_clear' undeclared (first use in this function)`,
+ "/some/unrelated/path",
+ "arch/x86/include/asm/nospec-branch.h",
+ },
+ {`
+ CC fs/notify/group.o
+ CC lib/zlib_deflate/deftree.o
+ CC net/ipv4/devinet.o
+ CC arch/x86/kernel/apic/apic_noop.o
+ CC arch/x86/kernel/crash_core_64.o
+ CC arch/x86/kernel/machine_kexec_64.o
+In file included from kernel/rcu/update.c:562:
+kernel/rcu/tasks.h: In function ‘show_rcu_tasks_gp_kthreads’:
+kernel/rcu/tasks.h:1070:37: error: ‘rcu_tasks_rude’ undeclared (first use in this function); did you mean ‘rcu_tasks_qs’?
+ 1070 | show_rcu_tasks_generic_gp_kthread(&rcu_tasks_rude, "");
+ | ^~~~~~~~~~~~~~
+ | rcu_tasks_qs
+kernel/rcu/tasks.h:1070:37: note: each undeclared identifier is reported only once for each function it appears in
+scripts/Makefile.build:267: recipe for target 'kernel/rcu/update.o' failed
+make[2]: *** [kernel/rcu/update.o] Error 1
+scripts/Makefile.build:505: recipe for target 'kernel/rcu' failed
+make[1]: *** [kernel/rcu] Error 2
+make[1]: *** Waiting for unfinished jobs....
+ CC net/ipv4/af_inet.o
+ CC crypto/blowfish_common.o
+ CC arch/x86/kernel/apic/ipi.o
+ CC sound/hda/hdac_controller.o
+`,
+ "kernel/rcu/tasks.h:1070:37: error: 'rcu_tasks_rude' undeclared (first use in this function); did you mean 'rcu_tasks_qs'?",
+ "",
+ "kernel/rcu/tasks.h",
+ },
+ {`
+ CC arch/x86/boot/compressed/kaslr.o
+ AS arch/x86/boot/compressed/mem_encrypt.o
+ CC arch/x86/boot/compressed/kaslr_64.o
+ CC arch/x86/boot/compressed/pgtable_64.o
+ CC arch/x86/boot/compressed/acpi.o
+clang-10: /home/glider/llvm-project/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp:941: void {anonymous}::X86AsmParser::SwitchMode(unsigned int): Assertion 'FeatureBitset({mode}) == (STI.getFeatureBits() & AllModes)' failed.
+Stack dump:
+0. Program arguments: /syzkaller/clang-kmsan/bin/clang-10 -cc1as -triple x86_64-unknown-linux-gnu -filetype obj -main-file-name head_64.S -target-cpu x86-64 -target-feature -mmx -target-feature -sse -I ./arch/x86/include -I ./arch/x86/include/generated -I ./include -I ./arch/x86/include/uapi -I ./arch/x86/include/generated/uapi -I ./include/uapi -I ./include/generated/uapi -fdebug-compilation-dir /syzkaller/managers/upstream-kmsan-gce/kernel -dwarf-debug-producer clang version 10.0.0 (/home/glider/llvm-project/clang c2443155a0fb245c8f17f2c1c72b6ea391e86e81) -I ./arch/x86/include -I ./arch/x86/include/generated -I ./include -I ./arch/x86/include/uapi -I ./arch/x86/include/generated/uapi -I ./include/uapi -I ./include/generated/uapi -dwarf-version=4 -mrelocation-model pic -o arch/x86/boot/compressed/head_64.o /tmp/head_64-984db4.s
+clang-10: /home/glider/llvm-project/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp:941: void {anonymous}::X86AsmParser::SwitchMode(unsigned int): Assertion 'FeatureBitset({mode}) == (STI.getFeatureBits() & AllModes)' failed.
+Stack dump:
+0. Program arguments: /syzkaller/clang-kmsan/bin/clang-10 -cc1as -triple x86_64-unknown-linux-gnu -filetype obj -main-file-name mem_encrypt.S -target-cpu x86-64 -target-feature -mmx -target-feature -sse -I ./arch/x86/include -I ./arch/x86/include/generated -I ./include -I ./arch/x86/include/uapi -I ./arch/x86/include/generated/uapi -I ./include/uapi -I ./include/generated/uapi -fdebug-compilation-dir /syzkaller/managers/upstream-kmsan-gce/kernel -dwarf-debug-producer clang version 10.0.0 (/home/glider/llvm-project/clang c2443155a0fb245c8f17f2c1c72b6ea391e86e81) -I ./arch/x86/include -I ./arch/x86/include/generated -I ./include -I ./arch/x86/include/uapi -I ./arch/x86/include/generated/uapi -I ./include/uapi -I ./include/generated/uapi -dwarf-version=4 -mrelocation-model pic -o arch/x86/boot/compressed/mem_encrypt.o /tmp/mem_encrypt-3c62ac.s
+/syzkaller/clang-kmsan/bin/clang-10(_ZN4llvm3sys15PrintStackTraceERNS_11raw_ostreamE+0x1a)[0x285af4a]
+/syzkaller/clang-kmsan/bin/clang-10(_ZN4llvm3sys15PrintStackTraceERNS_11raw_ostreamE+0x1a)[0x285af4a]
+/syzkaller/clang-kmsan/bin/clang-10(_ZN4llvm3sys17RunSignalHandlersEv+0x3a)[0x2858c2a]
+/syzkaller/clang-kmsan/bin/clang-10(_ZN4llvm3sys17RunSignalHandlersEv+0x3a)[0x2858c2a]
+/syzkaller/clang-kmsan/bin/clang-10[0x2858d47]
+/lib/x86_64-linux-gnu/libpthread.so.0(+0x11390)[0x14fcf8ccb390]
+/syzkaller/clang-kmsan/bin/clang-10[0x2858d47]
+/lib/x86_64-linux-gnu/libpthread.so.0(+0x11390)[0x14bb99841390]
+/lib/x86_64-linux-gnu/libc.so.6(gsignal+0x38)[0x14fcf7a5e428]
+/lib/x86_64-linux-gnu/libc.so.6(gsignal+0x38)[0x14bb985d4428]
+/lib/x86_64-linux-gnu/libc.so.6(abort+0x16a)[0x14fcf7a6002a]
+/lib/x86_64-linux-gnu/libc.so.6(abort+0x16a)[0x14bb985d602a]
+/lib/x86_64-linux-gnu/libc.so.6(+0x2dbd7)[0x14fcf7a56bd7]
+/lib/x86_64-linux-gnu/libc.so.6(+0x2dc82)[0x14fcf7a56c82]
+/lib/x86_64-linux-gnu/libc.so.6(+0x2dbd7)[0x14bb985ccbd7]
+/lib/x86_64-linux-gnu/libc.so.6(+0x2dc82)[0x14bb985ccc82]
+/syzkaller/clang-kmsan/bin/clang-10[0x9aa6d8]
+/syzkaller/clang-kmsan/bin/clang-10[0x9aa6d8]
+/syzkaller/clang-kmsan/bin/clang-10[0x1b094da]
+/syzkaller/clang-kmsan/bin/clang-10[0x1b094da]
+/syzkaller/clang-kmsan/bin/clang-10[0x1b0d3a1]
+/syzkaller/clang-kmsan/bin/clang-10[0x1b0d3a1]
+/syzkaller/clang-kmsan/bin/clang-10[0x257bc55]
+/syzkaller/clang-kmsan/bin/clang-10[0x257bc55]
+/syzkaller/clang-kmsan/bin/clang-10[0x257f274]
+/syzkaller/clang-kmsan/bin/clang-10[0xb86f8e]
+/syzkaller/clang-kmsan/bin/clang-10(_Z10cc1as_mainN4llvm8ArrayRefIPKcEES2_Pv+0xc3f)[0xb8ac3f]
+/syzkaller/clang-kmsan/bin/clang-10(main+0x18e3)[0xaeb2d3]
+/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x14fcf7a49830]
+/syzkaller/clang-kmsan/bin/clang-10[0x257f274]
+/syzkaller/clang-kmsan/bin/clang-10[0xb7f5d9]
+/syzkaller/clang-kmsan/bin/clang-10[0xb86f8e]
+/syzkaller/clang-kmsan/bin/clang-10(_Z10cc1as_mainN4llvm8ArrayRefIPKcEES2_Pv+0xc3f)[0xb8ac3f]
+/syzkaller/clang-kmsan/bin/clang-10(main+0x18e3)[0xaeb2d3]
+/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x14bb985bf830]
+/syzkaller/clang-kmsan/bin/clang-10[0xb7f5d9]
+clang-10: error: unable to execute command: Aborted (core dumped)
+clang-10: error: clang integrated assembler command failed due to signal (use -v to see invocation)
+clang version 10.0.0 (/home/glider/llvm-project/clang c2443155a0fb245c8f17f2c1c72b6ea391e86e81)
+Target: x86_64-unknown-linux-gnu
+Thread model: posix
+InstalledDir: /syzkaller/clang/bin
+clang-10: note: diagnostic msg: PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script.
+clang-10: error: unable to execute command: Aborted (core dumped)
+clang-10: error: clang integrated assembler command failed due to signal (use -v to see invocation)
+clang version 10.0.0 (/home/glider/llvm-project/clang c2443155a0fb245c8f17f2c1c72b6ea391e86e81)
+Target: x86_64-unknown-linux-gnu
+Thread model: posix
+InstalledDir: /syzkaller/clang/bin
+clang-10: note: diagnostic msg: PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script.
+clang-10: note: diagnostic msg:
+********************
+
+PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
+Preprocessed source(s) and associated run script(s) are located at:
+clang-10: note: diagnostic msg: /tmp/mem_encrypt-2af6ae.S
+clang-10: note: diagnostic msg: /tmp/mem_encrypt-2af6ae.sh
+clang-10: note: diagnostic msg:
+
+********************
+scripts/Makefile.build:348: recipe for target 'arch/x86/boot/compressed/mem_encrypt.o' failed
+make[2]: *** [arch/x86/boot/compressed/mem_encrypt.o] Error 254
+make[2]: *** Waiting for unfinished jobs....
+clang-10: note: diagnostic msg:
+********************
+
+PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
+Preprocessed source(s) and associated run script(s) are located at:
+clang-10: note: diagnostic msg: /tmp/head_64-96b27a.S
+clang-10: note: diagnostic msg: /tmp/head_64-96b27a.sh
+clang-10: note: diagnostic msg:
+
+********************
+scripts/Makefile.build:348: recipe for target 'arch/x86/boot/compressed/head_64.o' failed
+make[2]: *** [arch/x86/boot/compressed/head_64.o] Error 254
+arch/x86/boot/Makefile:115: recipe for target 'arch/x86/boot/compressed/vmlinux' failed
+make[1]: *** [arch/x86/boot/compressed/vmlinux] Error 2
+arch/x86/Makefile:284: recipe for target 'bzImage' failed
+make: *** [bzImage] Error 2
+`,
+ `clang-10: error: unable to execute command: Aborted (core dumped)
+clang-10: error: clang integrated assembler command failed due to signal (use -v to see invocation)`,
+ "",
+ "",
+ },
+ {`
+scripts/kconfig/conf --syncconfig Kconfig
+ DESCEND objtool
+ CALL scripts/atomic/check-atomics.sh
+ CALL scripts/checksyscalls.sh
+ CHK include/generated/compile.h
+ GZIP kernel/config_data.gz
+ CC kernel/configs.o
+ AR kernel/built-in.a
+ GEN .version
+ LD vmlinux.o
+ MODPOST vmlinux.o
+ MODINFO modules.builtin.modinfo
+ GEN modules.builtin
+ LD .tmp_vmlinux1
+arch/x86/platform/efi/efi_64.o: In function 'efi_thunk_set_virtual_address_map':
+/syzkaller/managers/upstream-linux-next-kasan-gce-root/kernel/arch/x86/platform/efi/efi_64.c:560: undefined reference to '__efi64_thunk'
+arch/x86/platform/efi/efi_64.o: In function 'efi_set_virtual_address_map':
+/syzkaller/managers/upstream-linux-next-kasan-gce-root/kernel/arch/x86/platform/efi/efi_64.c:902: undefined reference to 'efi_uv1_memmap_phys_prolog'
+/syzkaller/managers/upstream-linux-next-kasan-gce-root/kernel/arch/x86/platform/efi/efi_64.c:921: undefined reference to 'efi_uv1_memmap_phys_epilog'
+Makefile:1078: recipe for target 'vmlinux' failed
+make: *** [vmlinux] Error 1
+`,
+ `arch/x86/platform/efi/efi_64.c:560: undefined reference to '__efi64_thunk'
+arch/x86/platform/efi/efi_64.c:902: undefined reference to 'efi_uv1_memmap_phys_prolog'
+arch/x86/platform/efi/efi_64.c:921: undefined reference to 'efi_uv1_memmap_phys_epilog'`,
+ "/syzkaller/managers/upstream-linux-next-kasan-gce-root/kernel",
+ "arch/x86/platform/efi/efi_64.c",
+ },
+ {`
+/syzkaller/managers/upstream-linux-next-kasan-gce-root/kernel/arch/x86/platform/efi/efi_64.c:560: undefined reference to '__efi64_thunk'
+`,
+ `arch/x86/platform/efi/efi_64.c:560: undefined reference to '__efi64_thunk'`,
+ "/syzkaller/managers/upstream-linux-next-kasan-gce-root/kernel/",
+ "arch/x86/platform/efi/efi_64.c",
+ },
+ {`
+ CC net/ipv6/ip6_output.o
+ CC security/selinux/ss/policydb.o
+ CC net/ipv4/route.o
+In file included from security/smack/smack_netfilter.c:18:
+./include/linux/netfilter_ipv6.h: In function ‘nf_ipv6_br_defrag’:
+./include/linux/netfilter_ipv6.h:110:9: error: implicit declaration of function ‘nf_ct_frag6_gather’ [-Werror=implicit-function-declaration]
+ 110 | return nf_ct_frag6_gather(net, skb, user);
+ | ^~~~~~~~~~~~~~~~~~
+In file included from security/apparmor/lsm.c:27:
+./include/linux/netfilter_ipv6.h: In function ‘nf_ipv6_br_defrag’:
+./include/linux/netfilter_ipv6.h:110:9: error: implicit declaration of function ‘nf_ct_frag6_gather’ [-Werror=implicit-function-declaration]
+ 110 | return nf_ct_frag6_gather(net, skb, user);
+ | ^~~~~~~~~~~~~~~~~~
+In file included from net/bridge/br_netfilter_ipv6.c:30:
+./include/linux/netfilter_ipv6.h: In function ‘nf_ipv6_br_defrag’:
+./include/linux/netfilter_ipv6.h:110:9: error: implicit declaration of function ‘nf_ct_frag6_gather’ [-Werror=implicit-function-declaration]
+ 110 | return nf_ct_frag6_gather(net, skb, user);
+ | ^~~~~~~~~~~~~~~~~~
+In file included from net/bridge/br_netfilter_hooks.c:31:
+./include/linux/netfilter_ipv6.h: In function ‘nf_ipv6_br_defrag’:
+./include/linux/netfilter_ipv6.h:110:9: error: implicit declaration of function ‘nf_ct_frag6_gather’ [-Werror=implicit-function-declaration]
+ 110 | return nf_ct_frag6_gather(net, skb, user);
+ | ^~~~~~~~~~~~~~~~~~
+ CC net/openvswitch/datapath.o
+ CC net/llc/llc_output.o
+ CC net/ieee802154/core.o
+cc1: some warnings being treated as errors
+scripts/Makefile.build:278: recipe for target 'security/smack/smack_netfilter.o' failed
+make[2]: *** [security/smack/smack_netfilter.o] Error 1
+scripts/Makefile.build:489: recipe for target 'security/smack' failed
+make[1]: *** [security/smack] Error 2
+make[1]: *** Waiting for unfinished jobs....
+ CC net/lapb/lapb_iface.o
+ CC net/netlabel/netlabel_domainhash.o
+ CC net/netlabel/netlabel_addrlist.o
+`,
+ "./include/linux/netfilter_ipv6.h:110:9: error: implicit declaration of function 'nf_ct_frag6_gather' [-Werror=implicit-function-declaration]",
+ "",
+ "include/linux/netfilter_ipv6.h",
},
} {
- got := extractCauseInner([]byte(s.e))
- if s.expect != got {
- t.Errorf("Expected:\n%s\ngot:\n%s", s.expect, got)
- }
+ test := test
+ t.Run(fmt.Sprint(i), func(t *testing.T) {
+ reason, file := extractCauseInner([]byte(test.e), test.src)
+ if test.reason != string(reason) {
+ t.Errorf("expected:\n%s\ngot:\n%s", test.reason, reason)
+ }
+ if test.file != file {
+ t.Errorf("expected file: %q, got: %q", test.file, file)
+ }
+ })
}
}
diff --git a/pkg/report/linux.go b/pkg/report/linux.go
index 0657c4a13..95d1447a4 100644
--- a/pkg/report/linux.go
+++ b/pkg/report/linux.go
@@ -452,12 +452,16 @@ func (ctx *linux) getMaintainers(file string) ([]string, error) {
if ctx.kernelSrc == "" {
return nil, nil
}
- mtrs, err := ctx.getMaintainersImpl(file, false)
+ return GetLinuxMaintainers(ctx.kernelSrc, file)
+}
+
+func GetLinuxMaintainers(kernelSrc, file string) ([]string, error) {
+ mtrs, err := getMaintainersImpl(kernelSrc, file, false)
if err != nil {
return nil, err
}
if len(mtrs) <= 1 {
- mtrs, err = ctx.getMaintainersImpl(file, true)
+ mtrs, err = getMaintainersImpl(kernelSrc, file, true)
if err != nil {
return nil, err
}
@@ -465,7 +469,7 @@ func (ctx *linux) getMaintainers(file string) ([]string, error) {
return mtrs, nil
}
-func (ctx *linux) getMaintainersImpl(file string, blame bool) ([]string, error) {
+func getMaintainersImpl(kernelSrc, file string, blame bool) ([]string, error) {
// See #1441 re --git-min-percent.
args := []string{"--no-n", "--no-rolestats", "--git-min-percent=15"}
if blame {
@@ -473,7 +477,7 @@ func (ctx *linux) getMaintainersImpl(file string, blame bool) ([]string, error)
}
args = append(args, "-f", file)
script := filepath.FromSlash("scripts/get_maintainer.pl")
- output, err := osutil.RunCmd(time.Minute, ctx.kernelSrc, script, args...)
+ output, err := osutil.RunCmd(time.Minute, kernelSrc, script, args...)
if err != nil {
return nil, err
}