aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/csource
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2022-01-12 13:54:32 +0000
committerAleksandr Nogikh <wp32pw@gmail.com>2022-01-13 17:03:14 +0100
commitf635b41d90ee4c01636d9b7f67091aa2ce2c2f20 (patch)
tree51a479e96f86fa7b3cca4aff90f9067da6182b33 /pkg/csource
parent40c93acdacf984554ac152f1b7f06ba400fde8b0 (diff)
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.
Diffstat (limited to 'pkg/csource')
-rw-r--r--pkg/csource/csource.go7
1 files changed, 7 insertions, 0 deletions
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)