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 4include <sys/types.h> 5include <sys/fcntl.h> 6include <sys/stat.h> 7include <sys/ipc.h> 8include <sys/shm.h> 9include <sys/msg.h> 10include <sys/sem.h> 11 12resource ipc[int32]: 0, 0xffffffffffffffff 13 14# TODO: describe ipc syscall 15 16define SYS_semctl 510 17 18resource ipc_msq[ipc] 19msgget(key proc[2039379027, 4], flags flags[msgget_flags]) ipc_msq 20msgget$private(key const[IPC_PRIVATE], flags flags[msgget_flags]) ipc_msq 21msgsnd(msqid ipc_msq, msgp ptr[in, msgbuf], sz len[msgp], flags flags[msgsnd_flags]) 22msgrcv(msqid ipc_msq, msgp ptr[out, msgbuf], sz len[msgp], typ flags[msgbuf_type], flags flags[msgrcv_flags]) 23msgctl$IPC_STAT(msqid ipc_msq, cmd const[IPC_STAT], buf buffer[out]) 24msgctl$IPC_SET(msqid ipc_msq, cmd const[IPC_SET], buf ptr[in, msqid_ds]) 25msgctl$IPC_RMID(msqid ipc_msq, cmd const[IPC_RMID]) 26msgctl$IPC_INFO(msqid ipc_msq, cmd const[IPC_INFO], buf buffer[out]) 27 28resource ipc_sem[ipc] 29semget(key proc[2039359027, 4], nsems flags[sem_sem_id], flags flags[semget_flags]) ipc_sem 30semget$private(key const[IPC_PRIVATE], nsems flags[sem_sem_id], flags flags[semget_flags]) ipc_sem 31semop(semid ipc_sem, ops ptr[in, array[sembuf]], nops len[ops]) 32semctl$IPC_STAT(semid ipc_sem, semnum const[0], cmd const[IPC_STAT], arg buffer[out]) 33semctl$IPC_SET(semid ipc_sem, semnum const[0], cmd const[IPC_SET], arg ptr[in, semid_ds]) 34semctl$IPC_RMID(semid ipc_sem, semnum const[0], cmd const[IPC_RMID]) 35semctl$IPC_INFO(semid ipc_sem, semnum flags[sem_sem_id], cmd const[IPC_INFO], buf buffer[out]) 36semctl$SEM_INFO(semid ipc_sem, semnum flags[sem_sem_id], cmd const[SEM_INFO], arg buffer[out]) 37semctl$SEM_STAT(semid ipc_sem, semnum flags[sem_sem_id], cmd const[SEM_STAT], arg buffer[out]) 38semctl$GETALL(semid ipc_sem, semnum const[0], cmd const[GETALL], arg buffer[out]) 39semctl$GETNCNT(semid ipc_sem, semnum flags[sem_sem_id], cmd const[GETNCNT], arg buffer[out]) 40semctl$GETPID(semid ipc_sem, semnum flags[sem_sem_id], cmd const[GETPID], arg buffer[out]) 41semctl$GETVAL(semid ipc_sem, semnum flags[sem_sem_id], cmd const[GETVAL], arg buffer[out]) 42semctl$GETZCNT(semid ipc_sem, semnum flags[sem_sem_id], cmd const[GETZCNT], arg buffer[out]) 43semctl$SETALL(semid ipc_sem, semnum const[0], cmd const[SETALL], arg ptr[in, array[int16]]) 44semctl$SETVAL(semid ipc_sem, semnum flags[sem_sem_id], cmd const[SETVAL], arg ptr[in, int32]) 45 46resource ipc_shm[ipc] 47resource shmaddr[intptr]: 0 48# The unused arg is unused by syscall (does not exist at all), 49# but it helps to generate sane size values. 50shmget(key proc[2039339027, 4], size len[unused], flags flags[shmget_flags], unused vma) ipc_shm 51shmget$private(key const[IPC_PRIVATE], size len[unused], flags flags[shmget_flags], unused vma) ipc_shm 52shmat(shmid ipc_shm, addr vma, flags flags[shmat_flags]) shmaddr 53shmctl$IPC_STAT(shmid ipc_shm, cmd const[IPC_STAT], buf buffer[out]) 54shmctl$IPC_SET(shmid ipc_shm, cmd const[IPC_SET], buf ptr[in, shmid_ds]) 55shmctl$IPC_RMID(shmid ipc_shm, cmd const[IPC_RMID]) 56shmctl$IPC_INFO(shmid ipc_shm, cmd const[IPC_INFO], buf buffer[out]) 57shmctl$SHM_INFO(shmid ipc_shm, cmd const[SHM_INFO], buf buffer[out]) 58shmctl$SHM_STAT(shmid ipc_shm, cmd const[SHM_STAT], buf buffer[out]) 59shmctl$SHM_LOCK(shmid ipc_shm, cmd const[SHM_LOCK]) 60shmctl$SHM_UNLOCK(shmid ipc_shm, cmd const[SHM_UNLOCK]) 61shmdt(addr shmaddr) 62 63msgget_flags = IPC_CREAT, IPC_EXCL, S_IRUSR, S_IWUSR, S_IXUSR, S_IRGRP, S_IWGRP, S_IXGRP, S_IROTH, S_IWOTH, S_IXOTH 64msgbuf_type = 0, 1, 2, 3 65msgsnd_flags = IPC_NOWAIT 66msgrcv_flags = IPC_NOWAIT, MSG_NOERROR 67semget_flags = IPC_CREAT, IPC_EXCL, S_IRUSR, S_IWUSR, S_IXUSR, S_IRGRP, S_IWGRP, S_IXGRP, S_IROTH, S_IWOTH, S_IXOTH 68semop_flags = IPC_NOWAIT, SEM_UNDO 69sem_sem_id = 0, 1, 2, 3, 4 70shmget_flags = IPC_CREAT, IPC_EXCL, S_IRUSR, S_IWUSR, S_IXUSR, S_IRGRP, S_IWGRP, S_IXGRP, S_IROTH, S_IWOTH, S_IXOTH 71shmat_flags = SHM_RND, SHM_RDONLY 72 73ipc_perm { 74 key int32 75 uid uid 76 gid gid 77 cuid uid 78 cgid gid 79 mode flags[open_mode, int32] 80 seq int16 81 pad0 const[0, int16] 82 pad1 const[0, intptr] 83 pad2 const[0, intptr] 84} 85 86msqid_ds { 87 perm ipc_perm 88 stime intptr 89 rtime intptr 90 ctime intptr 91 cbytes intptr 92 qnum intptr 93 qbytes intptr 94 lspid pid 95 lrpid pid 96 pad0 const[0, intptr] 97 pad1 const[0, intptr] 98} 99 100shmid_ds { 101 perm ipc_perm 102 segsz int32 103 atime intptr 104 dtime intptr 105 ctime intptr 106 cpid pid 107 lpid pid 108 nattch int16 109 unused0 const[0, int16] 110 unused1 const[0, intptr] 111 unused2 const[0, intptr] 112} 113 114semid_ds { 115 perm ipc_perm 116 otime intptr 117 ctime intptr 118 nsems intptr 119 pad0 const[0, intptr] 120 pad1 const[0, intptr] 121} 122 123sembuf { 124 num flags[sem_sem_id, int16] 125 op int16 126 flg flags[semop_flags, int16] 127} 128 129msgbuf { 130 typ flags[msgbuf_type, intptr] 131 data array[int8] 132} [packed] 133