From 4fc2fa55acc12f9e82084e52521380b84be9a08b Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Wed, 6 Mar 2019 20:29:33 -0500 Subject: sys/freebsd: avoid mangling syscall names syz-extract was removing certain prefixes from syscall names, but this caused some problems: - freebsd* prefixes are for compatibility syscalls when the syscall ABI has changed. For instance, we have both fstat() and freebsd11_fstat(), and it is desirable to fuzz them both. - Stripping prefixes may leave us with undefined SYS_ constants. This resulted in some test failures in pkg/csource, which emitted code referencing SYS_semctl when it should have been SYS___semctl. Fix the problem by updating syscall descriptions to match the names given by the FreeBSD kernel. Add some new descriptions for compatibility syscalls, fix the mknodat() description (dev_t is now 64 bits wide on FreeBSD), and remove mknod$loop, which appears to be Linux-specific. --- executor/syscalls.h | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) (limited to 'executor/syscalls.h') diff --git a/executor/syscalls.h b/executor/syscalls.h index b4a05b087..1be9f2cb7 100644 --- a/executor/syscalls.h +++ b/executor/syscalls.h @@ -226,6 +226,20 @@ const call_t syscalls[] = { #if GOARCH_amd64 const call_t syscalls[] = { + {"__getcwd", 326}, + {"__semctl$GETALL", 510}, + {"__semctl$GETNCNT", 510}, + {"__semctl$GETPID", 510}, + {"__semctl$GETVAL", 510}, + {"__semctl$GETZCNT", 510}, + {"__semctl$IPC_INFO", 510}, + {"__semctl$IPC_RMID", 510}, + {"__semctl$IPC_SET", 510}, + {"__semctl$IPC_STAT", 510}, + {"__semctl$SEM_INFO", 510}, + {"__semctl$SEM_STAT", 510}, + {"__semctl$SETALL", 510}, + {"__semctl$SETVAL", 510}, {"accept", 30}, {"accept$inet", 30}, {"accept$inet6", 30}, @@ -270,12 +284,17 @@ const call_t syscalls[] = { {"fcntl$setstatus", 92}, {"fdatasync", 550}, {"flock", 131}, + {"freebsd10_pipe", 42}, + {"freebsd11_fstat", 189}, + {"freebsd11_getdents", 272}, + {"freebsd11_lstat", 190}, + {"freebsd11_mknod", 14}, + {"freebsd11_mknodat", 498}, + {"freebsd11_stat", 188}, {"fstat", 551}, {"fsync", 95}, {"ftruncate", 480}, {"futimesat", 494}, - {"getcwd", 326}, - {"getdents", 272}, {"getegid", 43}, {"geteuid", 25}, {"getgid", 47}, @@ -409,13 +428,10 @@ const call_t syscalls[] = { {"linkat", 495}, {"listen", 106}, {"lseek", 478}, - {"lstat", 190}, {"madvise", 75}, {"mincore", 78}, {"mkdir", 136}, {"mkdirat", 496}, - {"mknod", 14}, - {"mknod$loop", 14}, {"mknodat", 559}, {"mlock", 203}, {"mlockall", 324}, @@ -437,7 +453,6 @@ const call_t syscalls[] = { {"open", 5}, {"open$dir", 5}, {"openat", 499}, - {"pipe", 42}, {"pipe2", 542}, {"poll", 209}, {"ppoll", 545}, @@ -456,19 +471,6 @@ const call_t syscalls[] = { {"renameat", 501}, {"rmdir", 137}, {"select", 93}, - {"semctl$GETALL", 510}, - {"semctl$GETNCNT", 510}, - {"semctl$GETPID", 510}, - {"semctl$GETVAL", 510}, - {"semctl$GETZCNT", 510}, - {"semctl$IPC_INFO", 510}, - {"semctl$IPC_RMID", 510}, - {"semctl$IPC_SET", 510}, - {"semctl$IPC_STAT", 510}, - {"semctl$SEM_INFO", 510}, - {"semctl$SEM_STAT", 510}, - {"semctl$SETALL", 510}, - {"semctl$SETVAL", 510}, {"semget", 221}, {"semget$private", 221}, {"semop", 222}, @@ -647,7 +649,6 @@ const call_t syscalls[] = { {"socket$unix", 97}, {"socketpair", 135}, {"socketpair$unix", 135}, - {"stat", 188}, {"symlink", 57}, {"symlinkat", 502}, {"sync", 36}, -- cgit mrf-deployment