sys/syz-extract: support akaros

This commit is contained in:
Dmitry Vyukov 2017-10-14 18:36:17 +02:00
parent fb05d27bb8
commit 7553c19941
3 changed files with 36 additions and 0 deletions

34
sys/syz-extract/akaros.go Normal file
View File

@ -0,0 +1,34 @@
// Copyright 2017 syzkaller project authors. All rights reserved.
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
package main
import (
"fmt"
"path/filepath"
"github.com/google/syzkaller/pkg/compiler"
)
type akaros struct{}
func (*akaros) prepare(sourcedir string, build bool, arches []string) error {
if sourcedir == "" {
return fmt.Errorf("provide path to kernel checkout via -sourcedir flag (or make extract SOURCEDIR)")
}
return nil
}
func (*akaros) prepareArch(arch *Arch) error {
return nil
}
func (*akaros) processFile(arch *Arch, info *compiler.ConstInfo) (map[string]uint64, map[string]bool, error) {
dir := arch.sourceDir
syscallH := filepath.Join(dir, "kern", "include", "ros", "bits", "syscall.h")
args := []string{"-fmessage-length=0", "--include", syscallH}
for _, incdir := range info.Incdirs {
args = append(args, "-I"+filepath.Join(dir, incdir))
}
return extract(info, "gcc", args, "")
}

View File

@ -52,6 +52,7 @@ type OS interface {
}
var oses = map[string]OS{
"akaros": new(akaros),
"linux": new(linux),
"freebsd": new(freebsd),
"android": new(linux),

View File

@ -36,6 +36,7 @@ func extract(info *compiler.ConstInfo, cc string, args []string, addSource strin
}
for _, errMsg := range []string{
"error: ([a-zA-Z0-9_]+) undeclared",
"error: '([a-zA-Z0-9_]+)' undeclared",
"note: in expansion of macro ([a-zA-Z0-9_]+)",
} {
re := regexp.MustCompile(errMsg)