From 2c0b7b7ff31bbb899cc0c95766b5d04ebbd2d269 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Sat, 2 Sep 2017 13:21:47 +0200 Subject: pkg/compiler: restore generation of unsupported syscalls Unfortunately this is sitll needed, see the added comment. Update #191 --- pkg/compiler/consts.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'pkg/compiler') diff --git a/pkg/compiler/consts.go b/pkg/compiler/consts.go index 970a79050..44c0c4f18 100644 --- a/pkg/compiler/consts.go +++ b/pkg/compiler/consts.go @@ -139,6 +139,15 @@ func (comp *compiler) assignSyscallNumbers(consts map[string]uint64) { comp.warning(c.Pos, "unsupported syscall: %v due to missing const %v", c.CallName, str) } + // TODO: we still have to preserve the syscall. + // The problem is that manager and fuzzer use syscall indexes + // to communicate enabled syscalls. If manager is built for + // amd64 and fuzzer for arm64, then they would have different + // sets of syscalls and would not agree on syscall indexes. + // Remove this once we have proper cross-OS/arch support. + // The same happens in patchConsts. + c.NR = ^uint64(0) + top = append(top, decl) case *ast.IntFlags, *ast.Resource, *ast.Struct, *ast.StrFlags: top = append(top, decl) case *ast.NewLine, *ast.Comment, *ast.Include, *ast.Incdir, *ast.Define: @@ -205,7 +214,11 @@ func (comp *compiler) patchConsts(consts map[string]uint64) { } // We have to keep partially broken resources and structs, // because otherwise their usages will error. - if _, ok := decl.(*ast.Call); !ok { + if c, ok := decl.(*ast.Call); !ok { + top = append(top, decl) + } else { + // See comment in assignSyscallNumbers. + c.NR = ^uint64(0) top = append(top, decl) } } -- cgit mrf-deployment