github.com/google/syzkaller@v0.0.0-20240517125934-c0f1611a36d6/sys/fuchsia/posix.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  # This file contains some subset of POSIX/libc calls.
     5  # They should be handled by ulib/fs service rather then by the kernel,
     6  # but still no reason to not fuzz them.
     7  
     8  include <sys/types.h>
     9  include <sys/stat.h>
    10  include <sys/file.h>
    11  include <sys/uio.h>
    12  include <fcntl.h>
    13  include <poll.h>
    14  include <unistd.h>
    15  include <utime.h>
    16  
    17  resource fd[int32]: 0xffffffffffffffff, AT_FDCWD
    18  resource uid[int32]: 0, 0xffffffffffffffff
    19  resource gid[int32]: 0, 0xffffffffffffffff
    20  
    21  open(file ptr[in, filename], flags flags[open_flags], mode flags[open_mode]) fd
    22  openat(fd fd[opt], file ptr[in, filename], flags flags[open_flags], mode flags[open_mode]) fd
    23  creat(file ptr[in, filename], mode flags[open_mode]) fd
    24  close(fd fd)
    25  read(fd fd, buf buffer[out], count len[buf])
    26  readv(fd fd, vec ptr[in, array[iovec_out]], vlen len[vec])
    27  preadv(fd fd, vec ptr[in, array[iovec_out]], vlen len[vec], off fileoff)
    28  write(fd fd, buf buffer[in], count len[buf])
    29  writev(fd fd, vec ptr[in, array[iovec_in]], vlen len[vec])
    30  pwritev(fd fd, vec ptr[in, array[iovec_in]], vlen len[vec], off fileoff)
    31  lseek(fd fd, offset fileoff, whence flags[seek_whence])
    32  
    33  dup(oldfd fd) fd
    34  dup2(oldfd fd, newfd fd) fd
    35  dup3(oldfd fd, newfd fd, flags flags[dup_flags]) fd
    36  
    37  stat(file ptr[in, filename], statbuf ptr[out, array[int8]])
    38  lstat(file ptr[in, filename], statbuf ptr[out, array[int8]])
    39  fstat(fd fd, statbuf ptr[out, array[int8]])
    40  
    41  poll(fds ptr[in, array[pollfd]], nfds len[fds], timeout int32)
    42  ppoll(fds ptr[in, array[pollfd]], nfds len[fds], tsp ptr[in, timespec], sigmask ptr[in, sigset], size len[sigmask])
    43  select(n len[inp], inp ptr[inout, fd_set], outp ptr[inout, fd_set], exp ptr[inout, fd_set], tvp ptr[inout, timeval])
    44  
    45  chmod(file ptr[in, filename], mode flags[open_mode])
    46  fchmod(fd fd, mode flags[open_mode])
    47  fchmodat(dirfd fd, file ptr[in, filename], mode flags[open_mode])
    48  chown(file ptr[in, filename], uid uid, gid gid)
    49  lchown(file ptr[in, filename], uid uid, gid gid)
    50  fchown(fd fd, uid uid, gid gid)
    51  fchownat(dirfd fd, file ptr[in, filename], uid uid, gid gid, flags flags[at_flags])
    52  faccessat(dirfd fd, pathname ptr[in, filename], mode flags[open_mode], flags flags[faccessat_flags])
    53  utime(filename ptr[in, filename], times ptr[in, utimbuf])
    54  utimes(filename ptr[in, filename], times ptr[in, itimerval])
    55  utimensat(dir fd, pathname ptr[in, filename], times ptr[in, itimerval], flags flags[utimensat_flags])
    56  
    57  link(old ptr[in, filename], new ptr[in, filename])
    58  linkat(oldfd fd, old ptr[in, filename], newfd fd, new ptr[in, filename], flags flags[linkat_flags])
    59  symlinkat(old ptr[in, filename], newfd fd, new ptr[in, filename])
    60  symlink(old ptr[in, filename], new ptr[in, filename])
    61  unlink(path ptr[in, filename])
    62  unlinkat(fd fd, path ptr[in, filename], flags flags[unlinkat_flags])
    63  readlink(path ptr[in, filename], buf buffer[out], siz len[buf])
    64  readlinkat(fd fd, path ptr[in, filename], buf buffer[out], siz len[buf])
    65  rename(old ptr[in, filename], new ptr[in, filename])
    66  renameat(oldfd fd, old ptr[in, filename], newfd fd, new ptr[in, filename])
    67  mkdir(path ptr[in, filename], mode flags[open_mode])
    68  mkdirat(fd fd, path ptr[in, filename], mode flags[open_mode])
    69  rmdir(path ptr[in, filename])
    70  truncate(file ptr[in, filename], len intptr)
    71  ftruncate(fd fd, len intptr)
    72  fsync(fd fd)
    73  fdatasync(fd fd)
    74  sync()
    75  getcwd(buf buffer[out], size len[buf])
    76  chdir(dir ptr[in, filename])
    77  
    78  getgid() gid
    79  getuid() uid
    80  getpid()
    81  
    82  pipe(pipefd ptr[out, pipefd])
    83  
    84  pipefd {
    85  	rfd	fd
    86  	wfd	fd
    87  }
    88  
    89  open_flags = O_RDONLY, O_WRONLY, O_RDWR, O_APPEND, FASYNC, O_CLOEXEC, O_CREAT, O_DIRECT, O_DIRECTORY, O_EXCL, O_LARGEFILE, O_NOATIME, O_NOCTTY, O_NOFOLLOW, O_NONBLOCK, O_PATH, O_SYNC, O_TRUNC
    90  open_mode = S_IRUSR, S_IWUSR, S_IXUSR, S_IRGRP, S_IWGRP, S_IXGRP, S_IROTH, S_IWOTH, S_IXOTH
    91  seek_whence = SEEK_SET, SEEK_CUR, SEEK_END
    92  dup_flags = O_CLOEXEC
    93  pollfd_events = POLLIN, POLLPRI, POLLOUT, POLLERR, POLLHUP, POLLNVAL, POLLRDNORM, POLLRDBAND, POLLWRNORM, POLLWRBAND, POLLMSG, POLLRDHUP
    94  at_flags = AT_EMPTY_PATH, AT_SYMLINK_NOFOLLOW, AT_SYMLINK_FOLLOW, AT_NO_AUTOMOUNT, AT_EMPTY_PATH
    95  utimensat_flags = 0, AT_SYMLINK_NOFOLLOW
    96  linkat_flags = AT_EMPTY_PATH, AT_SYMLINK_FOLLOW
    97  unlinkat_flags = 0, AT_REMOVEDIR
    98  faccessat_flags = 0x100, 0x200, 0x400, 0x800, 0x1000
    99  
   100  iovec_in {
   101  	addr	buffer[in]
   102  	len	len[addr, intptr]
   103  }
   104  
   105  iovec_out {
   106  	addr	buffer[out]
   107  	len	len[addr, intptr]
   108  }
   109  
   110  sigset {
   111  	mask	int64
   112  }
   113  
   114  fd_set {
   115  	mask0	int64
   116  	mask1	int64
   117  	mask2	int64
   118  	mask3	int64
   119  	mask4	int64
   120  	mask5	int64
   121  	mask6	int64
   122  	mask7	int64
   123  }
   124  
   125  pollfd {
   126  	fd	fd
   127  	events	flags[pollfd_events, int16]
   128  	revents	const[0, int16]
   129  }
   130  
   131  timespec {
   132  	sec	intptr
   133  	nsec	intptr
   134  }
   135  
   136  timeval {
   137  	sec	intptr
   138  	usec	intptr
   139  }
   140  
   141  utimbuf {
   142  	actime	intptr
   143  	modtime	intptr
   144  }
   145  
   146  itimerval {
   147  	interv	timeval
   148  	value	timeval
   149  }