aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/csource/csource.go
diff options
context:
space:
mode:
authorAndrey Konovalov <andreyknvl@google.com>2017-07-05 14:01:33 +0200
committerAndrey Konovalov <andreyknvl@google.com>2017-07-05 15:46:38 +0200
commitd50208f93e83e1285319905cb9daaa0bb74e3719 (patch)
tree65336467c5db28c515cf37f08c21d98b8df417f7 /pkg/csource/csource.go
parent8adc4a749d6db797c4a8c9842ab3b3d2a71ee5fe (diff)
pkg/csourse: don't generate __NR_X defines for old syscalls
Diffstat (limited to 'pkg/csource/csource.go')
-rw-r--r--pkg/csource/csource.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/pkg/csource/csource.go b/pkg/csource/csource.go
index 056266726..89b916cb9 100644
--- a/pkg/csource/csource.go
+++ b/pkg/csource/csource.go
@@ -59,9 +59,13 @@ func Write(p *prog.Prog, opts Options) ([]byte, error) {
handled[c.Meta.CallName] = c.Meta.NR
}
for name, nr := range handled {
- fmt.Fprintf(w, "#ifndef __NR_%v\n", name)
- fmt.Fprintf(w, "#define __NR_%v %v\n", name, nr)
- fmt.Fprintf(w, "#endif\n")
+ // Only generate defines for new (added after commit 8a1ab3155c2ac on 2012-10-04) native syscalls.
+ // TODO: the syscall number 313 implies that we're dealing with linux/amd64.
+ if nr >= 313 && !strings.HasPrefix(name, "syz_") {
+ fmt.Fprintf(w, "#ifndef __NR_%v\n", name)
+ fmt.Fprintf(w, "#define __NR_%v %v\n", name, nr)
+ fmt.Fprintf(w, "#endif\n")
+ }
}
fmt.Fprintf(w, "\n")