github.com/google/syzkaller@v0.0.0-20240517125934-c0f1611a36d6/sys/freebsd/ipc.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/fcntl.h> 6 include <sys/filio.h> 7 include <sys/ipc.h> 8 include <sys/mman.h> 9 include <sys/msg.h> 10 include <sys/sem.h> 11 include <sys/shm.h> 12 include <sys/stat.h> 13 14 resource ipc[int32]: 0, 0xffffffffffffffff 15 16 # TODO: describe ipc syscall 17 18 define SYS___semctl 510 19 20 resource ipc_msq[ipc] 21 msgget(key proc[2039379027, 4], flags flags[msgget_flags]) ipc_msq 22 msgget$private(key const[IPC_PRIVATE], flags flags[msgget_flags]) ipc_msq 23 msgsnd(msqid ipc_msq, msgp ptr[in, msgbuf], sz len[msgp], flags flags[msgsnd_flags]) 24 msgrcv(msqid ipc_msq, msgp ptr[out, msgbuf], sz len[msgp], typ flags[msgbuf_type], flags flags[msgrcv_flags]) 25 msgctl$IPC_STAT(msqid ipc_msq, cmd const[IPC_STAT], buf buffer[out]) 26 msgctl$IPC_SET(msqid ipc_msq, cmd const[IPC_SET], buf ptr[in, msqid_ds]) 27 msgctl$IPC_RMID(msqid ipc_msq, cmd const[IPC_RMID]) 28 msgctl$IPC_INFO(msqid ipc_msq, cmd const[IPC_INFO], buf buffer[out]) 29 30 resource ipc_sem[ipc] 31 semget(key proc[2039359027, 4], nsems flags[sem_sem_id], flags flags[semget_flags]) ipc_sem 32 semget$private(key const[IPC_PRIVATE], nsems flags[sem_sem_id], flags flags[semget_flags]) ipc_sem 33 semop(semid ipc_sem, ops ptr[in, array[sembuf]], nops len[ops]) 34 35 # __semctl$GETVAL produces random errno values, so we use ignore_return attribute. 36 # Since we don't have strict const enforcement, we need to apply it to all variants. 37 # When/if we have stricter enforcement of arguments for syscall variants, we may remove some of the attributes. 38 39 __semctl$IPC_STAT(semid ipc_sem, semnum const[0], cmd const[IPC_STAT], arg ptr[in, ptr[out, semid_ds]]) (ignore_return) 40 __semctl$IPC_SET(semid ipc_sem, semnum const[0], cmd const[IPC_SET], arg ptr[in, ptr[in, semid_ds]]) (ignore_return) 41 __semctl$IPC_RMID(semid ipc_sem, semnum const[0], cmd const[IPC_RMID]) (ignore_return) 42 __semctl$SEM_STAT(semid ipc_sem, semnum flags[sem_sem_id], cmd const[SEM_STAT], arg ptr[in, ptr[out, semid_ds]]) (ignore_return) 43 __semctl$GETALL(semid ipc_sem, semnum const[0], cmd const[GETALL], arg ptr[in, array[int16]]) (ignore_return) 44 __semctl$GETNCNT(semid ipc_sem, semnum flags[sem_sem_id], cmd const[GETNCNT]) (ignore_return) 45 __semctl$GETZCNT(semid ipc_sem, semnum flags[sem_sem_id], cmd const[GETZCNT]) (ignore_return) 46 __semctl$GETPID(semid ipc_sem, semnum flags[sem_sem_id], cmd const[GETPID]) (ignore_return) 47 __semctl$GETVAL(semid ipc_sem, semnum flags[sem_sem_id], cmd const[GETVAL]) (ignore_return) 48 __semctl$SETALL(semid ipc_sem, semnum const[0], cmd const[SETALL], arg ptr[in, array[int16]]) (ignore_return) 49 __semctl$SETVAL(semid ipc_sem, semnum flags[sem_sem_id], cmd const[SETVAL], arg ptr[in, ptr[in, int32]]) (ignore_return) 50 51 resource ipc_shm[ipc] 52 resource shmaddr[intptr]: 0 53 # The unused arg is unused by syscall (does not exist at all), 54 # but it helps to generate sane size values. 55 shmget(key proc[2039339027, 4], size len[unused], flags flags[shmget_flags], unused vma) ipc_shm 56 shmget$private(key const[IPC_PRIVATE], size len[unused], flags flags[shmget_flags], unused vma) ipc_shm 57 shmat(shmid ipc_shm, addr vma, flags flags[shmat_flags]) shmaddr 58 shmctl$IPC_STAT(shmid ipc_shm, cmd const[IPC_STAT], buf buffer[out]) 59 shmctl$IPC_SET(shmid ipc_shm, cmd const[IPC_SET], buf ptr[in, shmid_ds]) 60 shmctl$IPC_RMID(shmid ipc_shm, cmd const[IPC_RMID]) 61 shmctl$IPC_INFO(shmid ipc_shm, cmd const[IPC_INFO], buf buffer[out]) 62 shmctl$SHM_INFO(shmid ipc_shm, cmd const[SHM_INFO], buf buffer[out]) 63 shmctl$SHM_STAT(shmid ipc_shm, cmd const[SHM_STAT], buf buffer[out]) 64 shmctl$SHM_LOCK(shmid ipc_shm, cmd const[SHM_LOCK]) 65 shmctl$SHM_UNLOCK(shmid ipc_shm, cmd const[SHM_UNLOCK]) 66 shmdt(addr shmaddr) 67 68 resource shmfd[fd] 69 70 freebsd12_shm_open(path ptr[in, filename], flags flags[shm_open_flags], mode flags[open_mode]) shmfd 71 shm_open2(path ptr[in, filename], flags flags[shm_open_flags], mode flags[open_mode], shmflags flags[shm_open2_flags], name ptr[in, string]) shmfd 72 shm_rename(from ptr[in, filename], to ptr[in, filename], flags flags[shm_rename_flags]) 73 shm_unlink(path ptr[in, filename]) 74 75 ioctl$FIOSSHMLPGCNF(fd shmfd, cmd const[FIOSSHMLPGCNF], arg ptr[in, shmlgpgconf]) 76 ioctl$FIOGSHMLPGCNF(fd shmfd, cmd const[FIOGSHMLPGCNF], arg ptr[out, shmlgpgconf]) 77 78 shmlgpgconf { 79 psind int32 80 alloc int32 81 pad array[const[0, int32], 10] 82 } 83 84 msgget_flags = IPC_CREAT, IPC_EXCL, open_mode 85 msgbuf_type = 0, 1, 2, 3 86 msgsnd_flags = IPC_NOWAIT 87 msgrcv_flags = IPC_NOWAIT, MSG_NOERROR 88 semget_flags = IPC_CREAT, IPC_EXCL, open_mode 89 semop_flags = IPC_NOWAIT, SEM_UNDO 90 sem_sem_id = 0, 1, 2, 3, 4 91 shmget_flags = IPC_CREAT, IPC_EXCL, open_mode 92 shmat_flags = SHM_RND, SHM_RDONLY 93 shm_open_flags = O_RDONLY, O_RDWR, O_CREAT, O_EXCL, O_TRUNC 94 shm_open2_flags = SHM_ALLOW_SEALING, SHM_GROW_ON_WRITE, SHM_LARGEPAGE 95 shm_rename_flags = SHM_RENAME_EXCHANGE, SHM_RENAME_NOREPLACE 96 97 ipc_perm { 98 cuid uid 99 cgid gid 100 uid uid 101 gid gid 102 mode flags[open_mode, int16] 103 seq int16 104 pad0 const[0, int32] 105 key intptr 106 } 107 108 msqid_ds { 109 perm ipc_perm 110 stime intptr 111 rtime intptr 112 ctime intptr 113 cbytes intptr 114 qnum intptr 115 qbytes intptr 116 lspid pid 117 lrpid pid 118 pad0 const[0, intptr] 119 pad1 const[0, intptr] 120 } 121 122 shmid_ds { 123 perm ipc_perm 124 segsz int32 125 atime intptr 126 dtime intptr 127 ctime intptr 128 cpid pid 129 lpid pid 130 nattch int16 131 unused0 const[0, int16] 132 unused1 const[0, intptr] 133 unused2 const[0, intptr] 134 } 135 136 semid_ds { 137 perm ipc_perm 138 base intptr 139 nsems int16 140 pad0 const[0, int16] 141 pad1 const[0, int32] 142 otime int64 143 ctime int64 144 } 145 146 sembuf { 147 num flags[sem_sem_id, int16] 148 op int16 149 flg flags[semop_flags, int16] 150 } 151 152 msgbuf { 153 typ flags[msgbuf_type, intptr] 154 data array[int8] 155 } [packed]