github.com/google/syzkaller@v0.0.0-20240517125934-c0f1611a36d6/sys/linux/dev_snd_pcm.txt (about) 1 # Copyright 2019 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 <uapi/asm/ioctl.h> 5 include <uapi/linux/fcntl.h> 6 include <uapi/linux/time.h> 7 include <uapi/sound/asound.h> 8 include <sound/pcm.h> 9 10 resource fd_snd_dsp[fd] 11 12 syz_open_dev$sndpcmc(dev ptr[in, string["/dev/snd/pcmC#D#c"]], id intptr, flags flags[open_flags]) fd_snd_dsp 13 syz_open_dev$sndpcmp(dev ptr[in, string["/dev/snd/pcmC#D#p"]], id intptr, flags flags[open_flags]) fd_snd_dsp 14 15 write$snddsp(fd fd_snd_dsp, data ptr[in, array[int8]], len bytesize[data]) 16 read$snddsp(fd fd_snd_dsp, data ptr[out, array[int8]], len bytesize[data]) 17 mmap$snddsp(addr vma, len len[addr], prot flags[mmap_prot], flags flags[mmap_flags], fd fd_snd_dsp, offset intptr[0:0x10000, 0x1000]) 18 mmap$snddsp_status(addr vma, len const[0x1000], prot flags[mmap_prot], flags flags[mmap_flags], fd fd_snd_dsp, offset const[SNDRV_PCM_MMAP_OFFSET_STATUS]) 19 mmap$snddsp_control(addr vma, len const[0x1000], prot flags[mmap_prot], flags flags[mmap_flags], fd fd_snd_dsp, offset const[SNDRV_PCM_MMAP_OFFSET_CONTROL]) 20 21 ioctl$SNDRV_PCM_IOCTL_INFO(fd fd_snd_dsp, cmd const[SNDRV_PCM_IOCTL_INFO], arg ptr[out, array[int8, SND_PCM_INFO_SIZE]]) 22 23 ioctl$SNDRV_PCM_IOCTL_TTSTAMP(fd fd_snd_dsp, cmd const[SNDRV_PCM_IOCTL_TTSTAMP], arg ptr[in, int32]) 24 ioctl$SNDRV_PCM_IOCTL_USER_PVERSION(fd fd_snd_dsp, cmd const[SNDRV_PCM_IOCTL_USER_PVERSION], arg ptr[in, int32]) 25 ioctl$SNDRV_PCM_IOCTL_HW_REFINE(fd fd_snd_dsp, cmd const[SNDRV_PCM_IOCTL_HW_REFINE], arg ptr[in, snd_pcm_hw_params]) 26 ioctl$SNDRV_PCM_IOCTL_HW_PARAMS(fd fd_snd_dsp, cmd const[SNDRV_PCM_IOCTL_HW_PARAMS], arg ptr[in, snd_pcm_hw_params]) 27 28 ioctl$SNDRV_PCM_IOCTL_HW_REFINE_OLD(fd fd_snd_dsp, cmd const[SNDRV_PCM_IOCTL_HW_REFINE_OLD], arg ptr[in, snd_pcm_hw_params_old]) 29 ioctl$SNDRV_PCM_IOCTL_HW_PARAMS_OLD(fd fd_snd_dsp, cmd const[SNDRV_PCM_IOCTL_HW_PARAMS_OLD], arg ptr[in, snd_pcm_hw_params_old]) 30 31 ioctl$SNDRV_PCM_IOCTL_HW_FREE(fd fd_snd_dsp, cmd const[SNDRV_PCM_IOCTL_HW_FREE], arg const[0]) 32 ioctl$SNDRV_PCM_IOCTL_SW_PARAMS(fd fd_snd_dsp, cmd const[SNDRV_PCM_IOCTL_SW_PARAMS], arg ptr[in, snd_pcm_sw_params]) 33 ioctl$SNDRV_PCM_IOCTL_STATUS32(fd fd_snd_dsp, cmd const[SNDRV_PCM_IOCTL_STATUS32], arg ptr[out, array[int8, SND_PCM_STATUS32_SIZE]]) 34 ioctl$SNDRV_PCM_IOCTL_STATUS64(fd fd_snd_dsp, cmd const[SNDRV_PCM_IOCTL_STATUS64], arg ptr[out, array[int8, SND_PCM_STATUS64_SIZE]]) 35 ioctl$SNDRV_PCM_IOCTL_DELAY(fd fd_snd_dsp, cmd const[SNDRV_PCM_IOCTL_DELAY], arg ptr[out, array[int8, SND_PCM_SFRAMES_SIZE]]) 36 ioctl$SNDRV_PCM_IOCTL_HWSYNC(fd fd_snd_dsp, cmd const[SNDRV_PCM_IOCTL_HWSYNC], arg const[0]) 37 ioctl$SNDRV_PCM_IOCTL_SYNC_PTR(fd fd_snd_dsp, cmd const[SNDRV_PCM_IOCTL_SYNC_PTR], arg ptr[in, snd_pcm_sync_ptr]) 38 ioctl$SNDRV_PCM_IOCTL_STATUS_EXT32(fd fd_snd_dsp, cmd const[SNDRV_PCM_IOCTL_STATUS_EXT32], arg ptr[in, snd_pcm_status32]) 39 ioctl$SNDRV_PCM_IOCTL_STATUS_EXT64(fd fd_snd_dsp, cmd const[SNDRV_PCM_IOCTL_STATUS_EXT64], arg ptr[in, snd_pcm_status64]) 40 ioctl$SNDRV_PCM_IOCTL_CHANNEL_INFO(fd fd_snd_dsp, cmd const[SNDRV_PCM_IOCTL_CHANNEL_INFO], arg ptr[out, array[int8, SND_PCM_CHANNEL_INFO_SIZE]]) 41 ioctl$SNDRV_PCM_IOCTL_PREPARE(fd fd_snd_dsp, cmd const[SNDRV_PCM_IOCTL_PREPARE], arg const[0]) 42 ioctl$SNDRV_PCM_IOCTL_RESET(fd fd_snd_dsp, cmd const[SNDRV_PCM_IOCTL_RESET], arg const[0]) 43 ioctl$SNDRV_PCM_IOCTL_START(fd fd_snd_dsp, cmd const[SNDRV_PCM_IOCTL_START], arg const[0]) 44 ioctl$SNDRV_PCM_IOCTL_DROP(fd fd_snd_dsp, cmd const[SNDRV_PCM_IOCTL_DROP], arg const[0]) 45 ioctl$SNDRV_PCM_IOCTL_DRAIN(fd fd_snd_dsp, cmd const[SNDRV_PCM_IOCTL_DRAIN], arg const[0]) 46 ioctl$SNDRV_PCM_IOCTL_PAUSE(fd fd_snd_dsp, cmd const[SNDRV_PCM_IOCTL_PAUSE], arg ptr[in, int32]) 47 ioctl$SNDRV_PCM_IOCTL_REWIND(fd fd_snd_dsp, cmd const[SNDRV_PCM_IOCTL_REWIND], arg ptr[in, intptr]) 48 ioctl$SNDRV_PCM_IOCTL_RESUME(fd fd_snd_dsp, cmd const[SNDRV_PCM_IOCTL_RESUME], arg const[0]) 49 ioctl$SNDRV_PCM_IOCTL_XRUN(fd fd_snd_dsp, cmd const[SNDRV_PCM_IOCTL_XRUN], arg const[0]) 50 ioctl$SNDRV_PCM_IOCTL_FORWARD(fd fd_snd_dsp, cmd const[SNDRV_PCM_IOCTL_FORWARD], arg ptr[in, intptr]) 51 ioctl$SNDRV_PCM_IOCTL_WRITEI_FRAMES(fd fd_snd_dsp, cmd const[SNDRV_PCM_IOCTL_WRITEI_FRAMES], arg ptr[in, snd_xferi]) 52 ioctl$SNDRV_PCM_IOCTL_READI_FRAMES(fd fd_snd_dsp, cmd const[SNDRV_PCM_IOCTL_READI_FRAMES], arg ptr[out, snd_xferi]) 53 ioctl$SNDRV_PCM_IOCTL_WRITEN_FRAMES(fd fd_snd_dsp, cmd const[SNDRV_PCM_IOCTL_WRITEN_FRAMES], arg ptr[in, snd_xfern]) 54 ioctl$SNDRV_PCM_IOCTL_READN_FRAMES(fd fd_snd_dsp, cmd const[SNDRV_PCM_IOCTL_READN_FRAMES], arg ptr[out, snd_xfern]) 55 ioctl$SNDRV_PCM_IOCTL_LINK(fd fd_snd_dsp, cmd const[SNDRV_PCM_IOCTL_LINK], arg ptr[in, int32]) 56 ioctl$SNDRV_PCM_IOCTL_UNLINK(fd fd_snd_dsp, cmd const[SNDRV_PCM_IOCTL_UNLINK], arg const[0]) 57 58 snd_pcm_hw_params { 59 flags int32 60 masks array[snd_mask, 3] 61 mres array[const[0, int32], 40] 62 intervals array[snd_interval, 12] 63 ires array[const[0, int32], 27] 64 rmask int32 65 cmask const[0, int32] 66 info const[0, int32] 67 msbits const[0, int32] 68 rate_num const[0, int32] 69 rate_den const[0, int32] 70 fifo_size const[0, intptr] 71 reserved array[const[0, int8], 64] 72 } 73 74 snd_pcm_hw_params_old { 75 flags int32 76 masks array[int32, 3] 77 intervals array[snd_interval, 12] 78 rmask int32 79 cmask const[0, int32] 80 info const[0, int32] 81 msbits const[0, int32] 82 rate_num const[0, int32] 83 rate_den const[0, int32] 84 fifo_size const[0, intptr] 85 reserved array[const[0, int8], 64] 86 } 87 88 snd_pcm_sw_params { 89 tstamp_mode bool32 90 period_step int32 91 sleep_min int32 92 avail_min intptr 93 xfer_align intptr 94 start_threshold intptr 95 stop_threshold intptr 96 silence_threshold intptr 97 silence_size intptr 98 boundary intptr 99 proto int32 100 tstamp_type flags[sndrv_pcm_audio_tstamp_type, int32] 101 reserved array[const[0, int8], 56] 102 } 103 104 snd_pcm_sync_ptr { 105 flags flags[snd_pcm_sync_flags, int32] 106 status array[int8, 64] 107 control snd_pcm_mmap_control 108 } [size[SND_PCM_SYNC_PTR_SIZE]] 109 110 snd_pcm_mmap_control { 111 appl_ptr intptr 112 avail_min intptr 113 } 114 115 snd_pcm_status32 { 116 state const[0, int32] 117 trigger_tstamp_sec const[0, int32] 118 trigger_tstamp_nsec const[0, int32] 119 tstamp_sec const[0, int32] 120 tstamp_nsec const[0, int32] 121 appl_ptr const[0, intptr] 122 hw_ptr const[0, intptr] 123 delay const[0, intptr] 124 avail const[0, intptr] 125 avail_max const[0, intptr] 126 overrange const[0, intptr] 127 suspended_state const[0, int32] 128 audio_tstamp_data flags[sndrv_pcm_audio_tstamp_type, int32] 129 } [size[SND_PCM_STATUS32_SIZE]] 130 131 snd_pcm_status64 { 132 state const[0, int32] 133 rsvd const[0, int32] 134 trigger_tstamp_sec const[0, int64] 135 trigger_tstamp_nsec const[0, int64] 136 tstamp_sec const[0, int64] 137 tstamp_nsec const[0, int64] 138 appl_ptr const[0, intptr] 139 hw_ptr const[0, intptr] 140 delay const[0, intptr] 141 avail const[0, intptr] 142 avail_max const[0, intptr] 143 overrange const[0, intptr] 144 suspended_state const[0, int32] 145 audio_tstamp_data flags[sndrv_pcm_audio_tstamp_type, int32] 146 } [size[SND_PCM_STATUS64_SIZE]] 147 148 snd_xferi { 149 result const[0, intptr] 150 buf ptr[in, array[int8]] 151 frames bytesize[buf, intptr] 152 } 153 154 snd_xfern { 155 result const[0, intptr] 156 buf ptr[in, array[ptr[in, array[int8]]]] 157 frames intptr 158 } 159 160 snd_interval { 161 min int32 162 max int32 163 openmin int32:1 164 openmax int32:1 165 integer int32:1 166 empty int32:1 167 } 168 169 type snd_mask array[int32, 8] 170 171 sndrv_pcm_audio_tstamp_type = SNDRV_PCM_AUDIO_TSTAMP_TYPE_COMPAT, SNDRV_PCM_AUDIO_TSTAMP_TYPE_DEFAULT, SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK, SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_ABSOLUTE, SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_ESTIMATED, SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_SYNCHRONIZED 172 snd_pcm_sync_flags = SNDRV_PCM_SYNC_PTR_HWSYNC, SNDRV_PCM_SYNC_PTR_APPL, SNDRV_PCM_SYNC_PTR_AVAIL_MIN 173 174 define SNDRV_PCM_IOCTL_HW_REFINE_OLD _IOWR('A', 0x10, struct {int a[62]; long b;}) 175 define SNDRV_PCM_IOCTL_HW_PARAMS_OLD _IOWR('A', 0x11, struct {int a[62]; long b;}) 176 define SND_PCM_INFO_SIZE sizeof(struct snd_pcm_info) 177 define SND_PCM_STATUS32_SIZE sizeof(struct snd_pcm_status32) 178 define SND_PCM_STATUS64_SIZE sizeof(struct snd_pcm_status64) 179 define SND_PCM_SFRAMES_SIZE sizeof(snd_pcm_sframes_t) 180 define SND_PCM_CHANNEL_INFO_SIZE sizeof(struct snd_pcm_channel_info) 181 define SND_PCM_SYNC_PTR_SIZE sizeof(struct snd_pcm_sync_ptr) 182 _ = __NR_mmap2