github.com/google/syzkaller@v0.0.0-20240517125934-c0f1611a36d6/sys/netbsd/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/stat.h>
     7  include <sys/ipc.h>
     8  include <sys/shm.h>
     9  include <sys/msg.h>
    10  include <sys/sem.h>
    11  
    12  resource ipc[int32]: 0, 0xffffffffffffffff
    13  
    14  # TODO: describe ipc syscall
    15  
    16  define SYS_____semctl50	442
    17  
    18  resource ipc_msq[ipc]
    19  msgget(key proc[2039379027, 4], flags flags[msgget_flags]) ipc_msq
    20  msgget$private(key const[IPC_PRIVATE], flags flags[msgget_flags]) ipc_msq
    21  msgsnd(msqid ipc_msq, msgp ptr[in, msgbuf], sz len[msgp], flags flags[msgsnd_flags])
    22  msgrcv(msqid ipc_msq, msgp ptr[out, msgbuf], sz len[msgp], typ flags[msgbuf_type], flags flags[msgrcv_flags])
    23  msgctl$IPC_STAT(msqid ipc_msq, cmd const[IPC_STAT], buf buffer[out])
    24  msgctl$IPC_SET(msqid ipc_msq, cmd const[IPC_SET], buf ptr[in, msqid_ds])
    25  msgctl$IPC_RMID(msqid ipc_msq, cmd const[IPC_RMID])
    26  compat_14_msgctl$IPC_STAT(msqid ipc_msq, cmd const[IPC_STAT], buf ptr[out, msqid_ds14])
    27  compat_14_msgctl$IPC_SET(msqid ipc_msq, cmd const[IPC_SET], buf ptr[in, msqid_ds14])
    28  compat_14_msgctl$IPC_RMID(msqid ipc_msq, cmd const[IPC_RMID])
    29  compat_50___msgctl13$IPC_STAT(msqid ipc_msq, cmd const[IPC_STAT], buf ptr[out, msqid_ds13])
    30  compat_50___msgctl13$IPC_SET(msqid ipc_msq, cmd const[IPC_SET], buf ptr[in, msqid_ds13])
    31  compat_50___msgctl13$IPC_RMID(msqid ipc_msq, cmd const[IPC_RMID])
    32  
    33  resource ipc_sem[ipc]
    34  semget(key proc[2039359027, 4], nsems flags[sem_sem_id], flags flags[semget_flags]) ipc_sem
    35  semget$private(key const[IPC_PRIVATE], nsems flags[sem_sem_id], flags flags[semget_flags]) ipc_sem
    36  semop(semid ipc_sem, ops ptr[in, array[sembuf]], nops len[ops])
    37  semctl$IPC_STAT(semid ipc_sem, semnum const[0], cmd const[IPC_STAT], arg buffer[out])
    38  semctl$IPC_SET(semid ipc_sem, semnum const[0], cmd const[IPC_SET], arg ptr[in, semid_ds])
    39  semctl$IPC_RMID(semid ipc_sem, semnum const[0], cmd const[IPC_RMID])
    40  semctl$GETALL(semid ipc_sem, semnum const[0], cmd const[GETALL], arg buffer[out])
    41  semctl$GETNCNT(semid ipc_sem, semnum flags[sem_sem_id], cmd const[GETNCNT], arg buffer[out])
    42  semctl$GETPID(semid ipc_sem, semnum flags[sem_sem_id], cmd const[GETPID], arg buffer[out])
    43  semctl$GETVAL(semid ipc_sem, semnum flags[sem_sem_id], cmd const[GETVAL], arg buffer[out])
    44  semctl$GETZCNT(semid ipc_sem, semnum flags[sem_sem_id], cmd const[GETZCNT], arg buffer[out])
    45  semctl$SETALL(semid ipc_sem, semnum const[0], cmd const[SETALL], arg ptr[in, array[int16]])
    46  semctl$SETVAL(semid ipc_sem, semnum flags[sem_sem_id], cmd const[SETVAL], arg ptr[in, int32])
    47  compat_14___semctl$IPC_STAT(semid ipc_sem, semnum const[0], cmd const[IPC_STAT], arg ptr[out, __semun])
    48  compat_14___semctl$IPC_SET(semid ipc_sem, semnum const[0], cmd const[IPC_SET], arg ptr[in, __semun])
    49  compat_14___semctl$IPC_RMID(semid ipc_sem, semnum const[0], cmd const[IPC_RMID])
    50  compat_14___semctl$SETALL(semid ipc_sem, semnum const[0], cmd const[SETALL], arg ptr[in, __semun])
    51  compat_14___semctl$GETALL(semid ipc_sem, semnum const[0], cmd const[GETALL], arg ptr[out, __semun])
    52  compat_14___semctl$GETZCNT(semid ipc_sem, semnum const[0], cmd const[GETZCNT])
    53  compat_14___semctl$GETNCNT(semid ipc_sem, semnum const[0], cmd const[GETNCNT])
    54  compat_14___semctl$GETPID(semid ipc_sem, semnum const[0], cmd const[GETPID])
    55  compat_14___semctl$SETVAL(semid ipc_sem, semnum const[0], cmd const[SETVAL], arg ptr[in, __semun])
    56  compat_14___semctl$GETVAL(semid ipc_sem, semnum const[0], cmd const[GETVAL])
    57  compat_50_____semctl13$IPC_STAT(semid ipc_sem, semnum const[0], cmd const[IPC_STAT], arg ptr[out, __semun])
    58  compat_50_____semctl13$IPC_SET(semid ipc_sem, semnum const[0], cmd const[IPC_SET], arg ptr[in, __semun])
    59  compat_50_____semctl13$IPC_RMID(semid ipc_sem, semnum const[0], cmd const[IPC_RMID])
    60  compat_50_____semctl13$SETALL(semid ipc_sem, semnum const[0], cmd const[SETALL], arg ptr[in, __semun])
    61  compat_50_____semctl13$GETALL(semid ipc_sem, semnum const[0], cmd const[GETALL], arg ptr[out, __semun])
    62  compat_50_____semctl13$GETZCNT(semid ipc_sem, semnum const[0], cmd const[GETZCNT])
    63  compat_50_____semctl13$GETNCNT(semid ipc_sem, semnum const[0], cmd const[GETNCNT])
    64  compat_50_____semctl13$GETPID(semid ipc_sem, semnum const[0], cmd const[GETPID])
    65  compat_50_____semctl13$SETVAL(semid ipc_sem, semnum const[0], cmd const[SETVAL], arg ptr[in, __semun])
    66  compat_50_____semctl13$GETVAL(semid ipc_sem, semnum const[0], cmd const[GETVAL])
    67  ____semctl50$IPC_STAT(semid ipc_sem, semnum const[0], cmd const[IPC_STAT], arg ptr[out, __semun])
    68  ____semctl50$IPC_SET(semid ipc_sem, semnum const[0], cmd const[IPC_SET], arg ptr[in, __semun])
    69  ____semctl50$IPC_RMID(semid ipc_sem, semnum const[0], cmd const[IPC_RMID])
    70  ____semctl50$SETALL(semid ipc_sem, semnum const[0], cmd const[SETALL], arg ptr[in, __semun])
    71  ____semctl50$GETALL(semid ipc_sem, semnum const[0], cmd const[GETALL], arg ptr[out, __semun])
    72  ____semctl50$GETZCNT(semid ipc_sem, semnum const[0], cmd const[GETZCNT])
    73  ____semctl50$GETNCNT(semid ipc_sem, semnum const[0], cmd const[GETNCNT])
    74  ____semctl50$GETPID(semid ipc_sem, semnum const[0], cmd const[GETPID])
    75  ____semctl50$SETVAL(semid ipc_sem, semnum const[0], cmd const[SETVAL], arg ptr[in, __semun])
    76  ____semctl50$GETVAL(semid ipc_sem, semnum const[0], cmd const[GETVAL])
    77  
    78  resource ipc_shm[ipc]
    79  resource shmaddr[intptr]: 0
    80  # The unused arg is unused by syscall (does not exist at all),
    81  # but it helps to generate sane size values.
    82  shmget(key proc[2039339027, 4], size len[unused], flags flags[shmget_flags], unused vma) ipc_shm
    83  shmget$private(key const[IPC_PRIVATE], size len[unused], flags flags[shmget_flags], unused vma) ipc_shm
    84  shmat(shmid ipc_shm, addr vma, flags flags[shmat_flags]) shmaddr
    85  shmctl$IPC_STAT(shmid ipc_shm, cmd const[IPC_STAT], buf buffer[out])
    86  shmctl$IPC_SET(shmid ipc_shm, cmd const[IPC_SET], buf ptr[in, shmid_ds])
    87  shmctl$IPC_RMID(shmid ipc_shm, cmd const[IPC_RMID])
    88  shmctl$SHM_LOCK(shmid ipc_shm, cmd const[SHM_LOCK])
    89  shmctl$SHM_UNLOCK(shmid ipc_shm, cmd const[SHM_UNLOCK])
    90  shmdt(addr shmaddr)
    91  compat_14_shmctl$IPC_STAT(shmid ipc_shm, cmd const[IPC_STAT], buf ptr[out, shmid_ds14])
    92  compat_14_shmctl$IPC_SET(shmid ipc_shm, cmd const[IPC_SET], buf ptr[in, shmid_ds14])
    93  compat_14_shmctl$IPC_RMID(shmid ipc_shm, cmd const[IPC_RMID])
    94  compat_14_shmctl$SHM_LOCK(shmid ipc_shm, cmd const[SHM_LOCK])
    95  compat_14_shmctl$SHM_UNLOCK(shmid ipc_shm, cmd const[SHM_UNLOCK])
    96  compat_50___shmctl13$IPC_STAT(shmid ipc_shm, cmd const[IPC_STAT], buf ptr[out, shmid_ds13])
    97  compat_50___shmctl13$IPC_SET(shmid ipc_shm, cmd const[IPC_SET], buf ptr[in, shmid_ds13])
    98  compat_50___shmctl13$IPC_RMID(shmid ipc_shm, cmd const[IPC_RMID])
    99  compat_50___shmctl13$SHM_LOCK(shmid ipc_shm, cmd const[SHM_LOCK])
   100  compat_50___shmctl13$SHM_UNLOCK(shmid ipc_shm, cmd const[SHM_UNLOCK])
   101  
   102  msgget_flags = IPC_CREAT, IPC_EXCL, S_IRUSR, S_IWUSR, S_IXUSR, S_IRGRP, S_IWGRP, S_IXGRP, S_IROTH, S_IWOTH, S_IXOTH
   103  msgbuf_type = 0, 1, 2, 3
   104  msgsnd_flags = IPC_NOWAIT
   105  msgrcv_flags = IPC_NOWAIT, MSG_NOERROR
   106  semget_flags = IPC_CREAT, IPC_EXCL, S_IRUSR, S_IWUSR, S_IXUSR, S_IRGRP, S_IWGRP, S_IXGRP, S_IROTH, S_IWOTH, S_IXOTH
   107  semop_flags = IPC_NOWAIT, SEM_UNDO
   108  sem_sem_id = 0, 1, 2, 3, 4
   109  shmget_flags = IPC_CREAT, IPC_EXCL, S_IRUSR, S_IWUSR, S_IXUSR, S_IRGRP, S_IWGRP, S_IXGRP, S_IROTH, S_IWOTH, S_IXOTH
   110  shmat_flags = SHM_RND, SHM_RDONLY
   111  
   112  ipc_perm {
   113  	key	int32
   114  	uid	uid
   115  	gid	gid
   116  	cuid	uid
   117  	cgid	gid
   118  	mode	flags[open_mode, int32]
   119  	seq	int16
   120  	pad0	const[0, int16]
   121  	pad1	const[0, intptr]
   122  	pad2	const[0, intptr]
   123  }
   124  
   125  msqid_ds {
   126  	perm	ipc_perm
   127  	qnum	intptr
   128  	qbytes	intptr
   129  	lspid	pid
   130  	lrpid	pid
   131  	stime	intptr
   132  	rtime	intptr
   133  	ctime	intptr
   134  	cbytes	intptr
   135  	pad0	const[0, intptr]
   136  	pad1	const[0, intptr]
   137  }
   138  
   139  shmid_ds {
   140  	perm	ipc_perm
   141  	segsz	int32
   142  	nattch	int16
   143  	cpid	pid
   144  	lpid	pid
   145  	atime	intptr
   146  	dtime	intptr
   147  	ctime	intptr
   148  	unused0	const[0, int16]
   149  	unused1	const[0, intptr]
   150  	unused2	const[0, intptr]
   151  }
   152  
   153  semid_ds {
   154  	perm	ipc_perm
   155  	otime	intptr
   156  	ctime	intptr
   157  	nsems	intptr
   158  	pad0	const[0, intptr]
   159  	pad1	const[0, intptr]
   160  }
   161  
   162  sembuf {
   163  	num	flags[sem_sem_id, int16]
   164  	op	int16
   165  	flg	flags[semop_flags, int16]
   166  }
   167  
   168  msgbuf {
   169  	typ	flags[msgbuf_type, intptr]
   170  	data	array[int8]
   171  } [packed]
   172  
   173  shmid_ds14 {
   174  	shm_perm	ipc_perm14
   175  	shm_segsz	int32
   176  	shm_lpid	int32
   177  	shm_cpid	int32
   178  	shm_nattch	int16
   179  	shm_atime	int32
   180  	shm_dtime	int32
   181  	shm_ctime	int32
   182  	shm_internal	buffer[in]
   183  }
   184  
   185  shmid_ds13 {
   186  	shm_perm	ipc_perm
   187  	shm_segsz	intptr
   188  	shm_lpid	int32
   189  	shm_cpid	int32
   190  	shm_nattch	int32
   191  	shm_atime	intptr
   192  	shm_dtime	intptr
   193  	shm_ctime	intptr
   194  	_shm_internal	buffer[in]
   195  }
   196  
   197  semid_ds13 {
   198  	sem_perm	ipc_perm13
   199  	sem_nsems	int16
   200  	sem_otime	intptr
   201  	sem_ctime	intptr
   202  	_sem_base	ptr[inout, __sem]
   203  }
   204  
   205  ipc_perm13 {
   206  	uid	uid
   207  	gid	gid
   208  	cuid	int32
   209  	cgid	int32
   210  	mode	flags[open_mode, int32]
   211  	_seq	int16
   212  	_key	intptr
   213  }
   214  
   215  __sem {
   216  	semval	int16
   217  	sempid	int32
   218  	semncnt	int16
   219  	semzcnt	int16
   220  }
   221  
   222  __semun [
   223  	val	int32
   224  	buf	ptr[inout, semid_ds13]
   225  	array	ptr[inout, int16]
   226  ]
   227  
   228  msqid_ds14 {
   229  	msg_perm	ipc_perm14
   230  	msg_first	ptr[inout, __msg]
   231  	msg_last	ptr[inout, __msg]
   232  	msg_cbytes	intptr
   233  	msg_qnum	intptr
   234  	msg_qbytes	intptr
   235  	msg_lspid	int32
   236  	msg_lrpid	int32
   237  	msg_stime	int32
   238  	msg_pad1	const[0, intptr]
   239  	msg_rtime	int32
   240  	msg_pad2	const[0, intptr]
   241  	msg_ctime	int32
   242  	msg_pad3	const[0, intptr]
   243  	msg_pad4	array[intptr, 4]
   244  }
   245  
   246  msqid_ds13 {
   247  	msg_perm	ipc_perm
   248  	msg_qnum	intptr
   249  	msg_qbytes	intptr
   250  	msg_lspid	int32
   251  	msg_lrpid	int32
   252  	msg_stime	intptr
   253  	msg_rtime	intptr
   254  	msg_ctime	intptr
   255  	_msg_first	ptr[in, __msg]
   256  	_msg_last	ptr[in, __msg]
   257  	_msg_cbytes	intptr
   258  }
   259  
   260  ipc_perm14 {
   261  	cuid	int16
   262  	cgid	int16
   263  	uid	int16
   264  	gid	int16
   265  	mode	flags[open_mode, int16]
   266  	seq	int16
   267  	key	intptr
   268  }
   269  
   270  __msg {
   271  	msg_next	ptr[inout, __msg, opt]
   272  	msg_type	intptr
   273  	msg_ts		int16
   274  	msg_spot	int16
   275  }