From f635b41d90ee4c01636d9b7f67091aa2ce2c2f20 Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Wed, 12 Jan 2022 13:54:32 +0000 Subject: all: explicitly list pseudo syscall dependencies Pseudo syscalls can (and most of the time) do invoke normal system calls. However, when there's a risk that those calls might not be present, syzkaller needs to take preventive actions - prepend the corresponding defines. Otherwise syz-executor or C reproducers might not compile on the host machine. List those dependencies in sys/targets, check them during machine check and add the corresponding defines during C source generation. --- pkg/csource/csource.go | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'pkg/csource/csource.go') diff --git a/pkg/csource/csource.go b/pkg/csource/csource.go index 6dd8bdcd6..1ba433f45 100644 --- a/pkg/csource/csource.go +++ b/pkg/csource/csource.go @@ -73,6 +73,13 @@ func (ctx *context) generateSource() ([]byte, error) { for _, c := range append(mmapProg.Calls, ctx.p.Calls...) { ctx.calls[c.Meta.CallName] = c.Meta.NR + for _, dep := range ctx.sysTarget.PseudoSyscallDeps[c.Meta.CallName] { + depCall := ctx.target.SyscallMap[dep] + if depCall == nil { + panic(dep + " is specified in PseudoSyscallDeps, but not present") + } + ctx.calls[depCall.CallName] = depCall.NR + } } varsBuf := new(bytes.Buffer) -- cgit mrf-deployment