diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2018-10-28 19:04:28 +0100 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2018-10-28 19:10:11 +0100 |
| commit | 6e045ca26d969f7465819984668417c9c3b47520 (patch) | |
| tree | 0048f316cbc9cabedcc6680294b9adfa1d85cae0 /sys/syz-extract/linux.go | |
| parent | 6d8b3311b9280ec497cd67855653c3e452ce02c9 (diff) | |
sys/syz-extract: support missing arch headers
The latest Linux kernel misses some arch-specific headers on some archs:
asm/a.out.h
asm/prctl.h
asm/mce.h
Support that.
Diffstat (limited to 'sys/syz-extract/linux.go')
| -rw-r--r-- | sys/syz-extract/linux.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/sys/syz-extract/linux.go b/sys/syz-extract/linux.go index 5c428461c..c5786a87d 100644 --- a/sys/syz-extract/linux.go +++ b/sys/syz-extract/linux.go @@ -43,6 +43,22 @@ func (*linux) prepare(sourcedir string, build bool, arches []string) error { } func (*linux) prepareArch(arch *Arch) error { + // Kernel misses these headers on all arches. + // So we create empty stubs in buildDir/syzkaller and add -IbuildDir/syzkaller + // as the last flag so it won't override real kernel headers. + for _, hdr := range []string{ + "asm/a.out.h", + "asm/prctl.h", + "asm/mce.h", + } { + fullPath := filepath.Join(arch.buildDir, "syzkaller", hdr) + if err := osutil.MkdirAll(filepath.Dir(fullPath)); err != nil { + return err + } + if err := osutil.WriteFile(fullPath, nil); err != nil { + return nil + } + } if !arch.build { return nil } @@ -100,6 +116,7 @@ func (*linux) processFile(arch *Arch, info *compiler.ConstInfo) (map[string]uint "-I" + sourceDir + "/include/uapi", "-I" + buildDir + "/include/generated/uapi", "-I" + sourceDir, + "-I" + buildDir + "/syzkaller", "-include", sourceDir + "/include/linux/kconfig.h", } args = append(args, arch.target.CFlags...) |
