github.com/google/syzkaller@v0.0.0-20240517125934-c0f1611a36d6/sys/openbsd/sys.txt (about)

     1  # Copyright 2017 syzkaller project authors. All rights reserved.
     2  # Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
     3  
     4  include <sys/types.h>
     5  include <sys/ioctl.h>
     6  include <sys/mman.h>
     7  include <sys/stat.h>
     8  include <fcntl.h>
     9  include <unistd.h>
    10  include <sys/time.h>
    11  include <dirent.h>
    12  include <poll.h>
    13  include <sys/select.h>
    14  include <sys/param.h>
    15  include <sys/resource.h>
    16  include <time.h>
    17  include <signal.h>
    18  include <sys/wait.h>
    19  
    20  syz_execute_func(text ptr[in, text[target]]) (disabled)
    21  
    22  pipe(pipefd ptr[out, pipefd])
    23  
    24  stat(file ptr[in, filename], statbuf ptr[out, stat])
    25  lstat(file ptr[in, filename], statbuf ptr[out, stat])
    26  
    27  chflags(file ptr[in, filename], flags flags[chflags_flags])
    28  fchflags(fd fd, flags flags[chflags_flags])
    29  chflagsat(dirfd fd_dir, file ptr[in, filename], flags flags[chflags_flags], atflags flags[chflagsat_flags])
    30  
    31  poll(fds ptr[in, array[pollfd]], nfds len[fds], timeout int32)
    32  select(n len[inp], inp ptr[inout, fd_set], outp ptr[inout, fd_set], exp ptr[inout, fd_set], tvp ptr[inout, timeval])
    33  
    34  fcntl$dupfd(fd fd, cmd flags[fcntl_dupfd], arg fd) fd
    35  fcntl$getflags(fd fd, cmd flags[fcntl_getflags])
    36  fcntl$setflags(fd fd, cmd const[F_SETFD], flags flags[fcntl_flags])
    37  fcntl$setstatus(fd fd, cmd const[F_SETFL], flags flags[fcntl_status])
    38  fcntl$lock(fd fd, cmd flags[fcntl_lock], lock ptr[in, flock])
    39  fcntl$getown(fd fd, cmd const[F_GETOWN]) pid
    40  fcntl$setown(fd fd, cmd const[F_SETOWN], pid pid)
    41  
    42  ioctl$FIOASYNC(fd fd, cmd const[FIOASYNC], arg ptr[in, int32])
    43  ioctl$FIOGETOWN(fd fd, cmd const[FIOGETOWN], arg ptr[out, int32])
    44  ioctl$FIONBIO(fd fd, cmd const[FIONBIO], arg ptr[in, int32])
    45  ioctl$FIONREAD(fd fd, cmd const[FIONREAD], arg ptr[out, int32])
    46  ioctl$FIOSETOWN(fd fd, cmd const[FIOSETOWN], arg ptr[in, int32])
    47  
    48  mknod(file ptr[in, filename], mode flags[mknod_mode], dev int32)
    49  mknod$loop(file ptr[in, filename], mode flags[mknod_mode], dev proc[1792, 2])
    50  mknodat(dirfd fd_dir, file ptr[in, filename], mode flags[mknod_mode], dev int32)
    51  chmod(file ptr[in, filename], mode flags[open_mode])
    52  fchmod(fd fd, mode flags[open_mode])
    53  fchmodat(dirfd fd_dir, file ptr[in, filename], mode flags[open_mode], flags flags[at_flags])
    54  chown(file ptr[in, filename], uid uid, gid gid)
    55  lchown(file ptr[in, filename], uid uid, gid gid)
    56  fchown(fd fd, uid uid, gid gid)
    57  fchownat(dirfd fd_dir, file ptr[in, filename], uid uid, gid gid, flags flags[at_flags])
    58  faccessat(dirfd fd_dir, pathname ptr[in, filename], mode flags[open_mode], flags flags[faccessat_flags])
    59  utimes(filename ptr[in, filename], times ptr[in, itimerval])
    60  utimensat(dir fd_dir, pathname ptr[in, filename], times ptr[in, itimerval], flags flags[utimensat_flags])
    61  
    62  execve(file ptr[in, filename], argv ptr[in, array[ptr[in, string]]], envp ptr[in, array[ptr[in, string]]])
    63  
    64  getgid() gid
    65  getegid() gid
    66  setuid(uid uid)
    67  setgid(gid gid)
    68  seteuid(euid uid)
    69  setegid(egid gid)
    70  getuid() uid
    71  geteuid() uid
    72  setpgid(pid pid, pgid pid)
    73  getpgid(pid pid) pid
    74  getpgrp() pid
    75  getpid() pid
    76  getppid() pid
    77  setreuid(ruid uid, euid uid)
    78  setregid(rgid gid, egid gid)
    79  getgroups(size len[list], list ptr[inout, array[gid]])
    80  setgroups(size len[list], list ptr[in, array[gid]])
    81  
    82  link(old ptr[in, filename], new ptr[in, filename])
    83  linkat(oldfd fd_dir, old ptr[in, filename], newfd fd_dir, new ptr[in, filename], flags flags[linkat_flags])
    84  symlinkat(old ptr[in, filename], newfd fd_dir, new ptr[in, filename])
    85  symlink(old ptr[in, filename], new ptr[in, filename])
    86  unlink(path ptr[in, filename])
    87  unlinkat(fd fd_dir, path ptr[in, filename], flags flags[unlinkat_flags])
    88  readlink(path ptr[in, filename], buf buffer[out], siz len[buf])
    89  readlinkat(fd fd_dir, path ptr[in, filename], buf buffer[out], siz len[buf])
    90  rename(old ptr[in, filename], new ptr[in, filename])
    91  renameat(oldfd fd_dir, old ptr[in, filename], newfd fd_dir, new ptr[in, filename])
    92  mkdir(path ptr[in, filename], mode flags[open_mode])
    93  mkdirat(fd fd_dir, path ptr[in, filename], mode flags[open_mode])
    94  rmdir(path ptr[in, filename])
    95  truncate(file ptr[in, filename], len intptr)
    96  ftruncate(fd fd, len intptr)
    97  flock(fd fd, op flags[flock_op])
    98  fsync(fd fd)
    99  # fdatasync(fd fd)
   100  sync()
   101  getdents(fd fd_dir, ent buffer[out], count len[ent])
   102  chroot(dir ptr[in, filename])
   103  # fchroot(fd fd)
   104  chdir(dir ptr[in, filename])
   105  fchdir(fd fd)
   106  
   107  getrusage(who flags[rusage_who], usage ptr[out, rusage])
   108  getrlimit(res flags[rlimit_type], rlim ptr[out, rlimit])
   109  setrlimit(res flags[rlimit_type], rlim ptr[in, rlimit])
   110  
   111  clock_gettime(id flags[clock_id], tp ptr[out, timespec])
   112  clock_settime(id flags[clock_id], tp ptr[in, timespec])
   113  clock_getres(id flags[clock_id], tp ptr[out, timespec])
   114  nanosleep(req ptr[in, timespec], rem ptr[out, timespec, opt])
   115  getitimer(which flags[getitimer_which], cur ptr[out, itimerval])
   116  setitimer(which flags[getitimer_which], new ptr[in, itimerval], old ptr[out, itimerval, opt])
   117  wait4(pid pid, status ptr[out, int32, opt], options flags[wait_options], ru ptr[out, rusage, opt])
   118  
   119  pledge(promises ptr[in, string], execpromises ptr[in, string])
   120  unveil(path ptr[in, filename], permissions ptr[in, string[unveil_permissions]])
   121  
   122  acct(path ptr[in, filename])
   123  
   124  openat$null(fd const[AT_FDCWD], file ptr[in, string["/dev/null"]], flags flags[open_flags], mode const[0]) fd
   125  openat$zero(fd const[AT_FDCWD], file ptr[in, string["/dev/zero"]], flags flags[open_flags], mode const[0]) fd
   126  
   127  pollfd {
   128  	fd	fd
   129  	events	flags[pollfd_events, int16]
   130  	revents	const[0, int16]
   131  }
   132  
   133  # prog knowns about this struct type
   134  timespec {
   135  	sec	intptr
   136  	nsec	intptr
   137  }
   138  
   139  # prog knowns about this struct type
   140  timeval {
   141  	sec	intptr
   142  	usec	intptr
   143  }
   144  
   145  itimerval {
   146  	interv	timeval
   147  	value	timeval
   148  }
   149  
   150  # TODO: fd_set needs to be a separate type
   151  fd_set {
   152  	mask0	int64
   153  	mask1	int64
   154  	mask2	int64
   155  	mask3	int64
   156  	mask4	int64
   157  	mask5	int64
   158  	mask6	int64
   159  	mask7	int64
   160  }
   161  
   162  rusage {
   163  	utime	timeval
   164  	stime	timeval
   165  	maxrss	intptr
   166  	ixrss	intptr
   167  	idrss	intptr
   168  	isrss	intptr
   169  	minflt	intptr
   170  	majflt	intptr
   171  	nswap	intptr
   172  	inblock	intptr
   173  	oublock	intptr
   174  	msgsnd	intptr
   175  	msgrcv	intptr
   176  	signals	intptr
   177  	nvcsw	intptr
   178  	nivcsw	intptr
   179  }
   180  
   181  rlimit {
   182  	soft	intptr
   183  	hard	intptr
   184  }
   185  
   186  flock {
   187  	type	flags[flock_type, int16]
   188  	whence	flags[seek_whence, int16]
   189  	start	intptr
   190  	len	intptr
   191  	pid	pid
   192  }
   193  
   194  linger {
   195  	onoff	int32
   196  	linger	int32
   197  }
   198  
   199  ucred {
   200  	pid	pid
   201  	uid	uid
   202  	gid	gid
   203  }
   204  
   205  chflags_flags = UF_NODUMP, UF_IMMUTABLE, UF_APPEND, SF_ARCHIVED, SF_IMMUTABLE, SF_APPEND
   206  chflagsat_flags = AT_SYMLINK_NOFOLLOW
   207  pollfd_events = POLLIN, POLLPRI, POLLOUT, POLLERR, POLLHUP, POLLNVAL, POLLRDNORM, POLLRDBAND, POLLWRNORM, POLLWRBAND
   208  mknod_mode = S_IFMT, S_IFREG, S_IFCHR, S_IFBLK, S_IFIFO, S_IFSOCK, open_mode
   209  at_flags = AT_SYMLINK_NOFOLLOW, AT_SYMLINK_FOLLOW
   210  linkat_flags = AT_SYMLINK_FOLLOW
   211  unlinkat_flags = 0, AT_REMOVEDIR
   212  flock_op = LOCK_SH, LOCK_EX, LOCK_UN, LOCK_NB
   213  faccessat_flags = AT_EACCESS, AT_SYMLINK_NOFOLLOW
   214  rusage_who = RUSAGE_SELF, RUSAGE_CHILDREN
   215  rlimit_type = RLIMIT_CORE, RLIMIT_CPU, RLIMIT_DATA, RLIMIT_FSIZE, RLIMIT_MEMLOCK, RLIMIT_NOFILE, RLIMIT_NPROC, RLIMIT_RSS, RLIMIT_STACK, RLIMIT_STACK
   216  clock_id = CLOCK_REALTIME, CLOCK_MONOTONIC, CLOCK_PROCESS_CPUTIME_ID, CLOCK_THREAD_CPUTIME_ID
   217  getitimer_which = ITIMER_REAL, ITIMER_VIRTUAL, ITIMER_PROF
   218  wait_options = WCONTINUED, WNOHANG, WUNTRACED
   219  utimensat_flags = 0, AT_SYMLINK_NOFOLLOW
   220  fcntl_dupfd = F_DUPFD, F_DUPFD_CLOEXEC
   221  fcntl_getflags = F_GETFD, F_GETFL
   222  fcntl_lock = F_SETLK, F_SETLKW, F_GETLK
   223  fcntl_flags = FD_CLOEXEC
   224  fcntl_status = O_APPEND, O_ASYNC, O_NONBLOCK, O_DSYNC, O_RSYNC
   225  flock_type = F_RDLCK, F_WRLCK, F_UNLCK
   226  unveil_permissions = "r", "W", "x", "c"