github.com/google/syzkaller@v0.0.0-20240517125934-c0f1611a36d6/sys/linux/dev_cdrom.txt (about) 1 # Copyright 2018 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 # For fuzzing with qemu you need to enable cdrom option and provide an iso image. 5 # For example: in "vm" section of syzkaller configuration 6 # "vm" : { 7 # ... 8 # "cmdline": " -cdrom /.../ubuntu-18.04-desktop-amd64.iso " 9 # } 10 # In the kernel CONFIG_CDROM should be enabled. 11 # 12 # For more effective fuzzing one might want to disable 13 # CDROMEJECT && CDROMEJECT_SW. 14 # "disable_syscalls" : [ "ioctl$CDROMEJECT*" ] 15 16 include <linux/cdrom.h> 17 include <uapi/linux/cdrom.h> 18 19 resource fd_cdrom[fd] 20 21 openat$cdrom(fd const[AT_FDCWD], file ptr[in, string["/dev/cdrom"]], flags flags[open_flags], mode const[0]) fd_cdrom 22 openat$cdrom1(fd const[AT_FDCWD], file ptr[in, string["/dev/cdrom1"]], flags flags[open_flags], mode const[0]) fd_cdrom 23 24 ioctl$CDROMPAUSE(fd fd_cdrom, cmd const[CDROMPAUSE]) 25 ioctl$CDROMRESUME(fd fd_cdrom, cmd const[CDROMRESUME]) 26 ioctl$CDROMPLAYMSF(fd fd_cdrom, cmd const[CDROMPLAYMSF], arg ptr[in, cdrom_msf]) 27 ioctl$CDROMPLAYTRKIND(fd fd_cdrom, cmd const[CDROMPLAYTRKIND], arg ptr[in, cdrom_ti]) 28 ioctl$CDROMREADTOCHDR(fd fd_cdrom, cmd const[CDROMREADTOCHDR], arg ptr[inout, cdrom_tochdr]) 29 ioctl$CDROMREADTOCENTRY(fd fd_cdrom, cmd const[CDROMREADTOCENTRY], arg ptr[inout, cdrom_tocentry]) 30 ioctl$CDROMSTOP(fd fd_cdrom, cmd const[CDROMSTOP]) 31 ioctl$CDROMSTART(fd fd_cdrom, cmd const[CDROMSTART]) 32 ioctl$CDROMEJECT(fd fd_cdrom, cmd const[CDROMEJECT]) 33 ioctl$CDROMVOLCTRL(fd fd_cdrom, cmd const[CDROMVOLCTRL], arg ptr[in, cdrom_volctrl]) 34 ioctl$CDROMSUBCHNL(fd fd_cdrom, cmd const[CDROMSUBCHNL], arg ptr[inout, cdrom_subchnl]) 35 ioctl$CDROMREADMODE2(fd fd_cdrom, cmd const[CDROMREADMODE2], arg ptr[in, cdrom_msf_out_stub]) 36 ioctl$CDROMREADMODE1(fd fd_cdrom, cmd const[CDROMREADMODE1], arg ptr[in, cdrom_msf_out_stub]) 37 ioctl$CDROMREADAUDIO(fd fd_cdrom, cmd const[CDROMREADAUDIO], arg ptr[in, cdrom_read_audio]) 38 ioctl$CDROMEJECT_SW(fd fd_cdrom, cmd const[CDROMEJECT_SW], arg boolptr) 39 ioctl$CDROMMULTISESSION(fd fd_cdrom, cmd const[CDROMMULTISESSION], arg ptr[inout, cdrom_multisession]) 40 ioctl$CDROM_GET_MCN(fd fd_cdrom, cmd const[CDROM_GET_MCN], arg ptr[out, cdrom_mcn]) 41 ioctl$CDROMRESET(fd fd_cdrom, cmd const[CDROMRESET]) 42 ioctl$CDROMVOLREAD(fd fd_cdrom, cmd const[CDROMVOLREAD], arg ptr[out, cdrom_volctrl]) 43 ioctl$CDROMREADRAW(fd fd_cdrom, cmd const[CDROMREADRAW], arg ptr[in, cdrom_msf_out_stub]) 44 45 ioctl$CDROMREADCOOKED(fd fd_cdrom, cmd const[CDROMREADCOOKED], arg ptr[out, cdrom_output_buffer]) 46 ioctl$CDROMSEEK(fd fd_cdrom, cmd const[CDROMSEEK], arg ptr[in, cdrom_msf]) 47 48 ioctl$CDROMPLAYBLK(fd fd_cdrom, cmd const[CDROMPLAYBLK], arg ptr[in, cdrom_blk]) 49 50 ioctl$CDROMREADALL(fd fd_cdrom, cmd const[CDROMREADALL], arg ptr[out, cdrom_output_buffer]) 51 52 ioctl$CDROMGETSPINDOWN(fd fd_cdrom, cmd const[CDROMGETSPINDOWN], arg ptr[out, int8]) 53 ioctl$CDROMSETSPINDOWN(fd fd_cdrom, cmd const[CDROMSETSPINDOWN], arg ptr[in, int8[0:15]]) 54 55 ioctl$CDROMCLOSETRAY(fd fd_cdrom, cmd const[CDROMCLOSETRAY]) 56 57 ioctl$CDROM_SET_OPTIONS(fd fd_cdrom, cmd const[CDROM_SET_OPTIONS], arg flags[cdrom_options]) 58 ioctl$CDROM_CLEAR_OPTIONS(fd fd_cdrom, cmd const[CDROM_CLEAR_OPTIONS], arg flags[cdrom_options]) 59 ioctl$CDROM_SELECT_SPEED(fd fd_cdrom, cmd const[CDROM_SELECT_SPEED], speed intptr) 60 ioctl$CDROM_SELECT_DISK(fd fd_cdrom, cmd const[CDROM_SELECT_SPEED], disk intptr) 61 ioctl$CDROM_MEDIA_CHANGED(fd fd_cdrom, cmd const[CDROM_MEDIA_CHANGED], slot intptr) 62 ioctl$CDROM_TIMED_MEDIA_CHANGE(fd fd_cdrom, cmd const[CDROM_TIMED_MEDIA_CHANGE], arg ptr[inout, cdrom_timed_media_change_info]) 63 ioctl$CDROM_DISC_STATUS(fd fd_cdrom, cmd const[CDROM_DISC_STATUS]) 64 ioctl$CDROM_CHANGER_NSLOTS(fd fd_cdrom, cmd const[CDROM_CHANGER_NSLOTS]) 65 ioctl$CDROM_LOCKDOOR(fd fd_cdrom, cmd const[CDROM_LOCKDOOR], lock boolptr) 66 ioctl$CDROM_DEBUG(fd fd_cdrom, cmd const[CDROM_DEBUG], debug boolptr) 67 ioctl$CDROM_GET_CAPABILITY(fd fd_cdrom, cmd const[CDROM_GET_CAPABILITY]) 68 69 ioctl$DVD_READ_STRUCT(fd fd_cdrom, cmd const[DVD_READ_STRUCT], arg ptr[inout, dvd_struct]) 70 ioctl$DVD_WRITE_STRUCT(fd fd_cdrom, cmd const[DVD_READ_STRUCT], arg ptr[in, dvd_struct]) 71 ioctl$DVD_AUTH(fd fd_cdrom, cmd const[DVD_READ_STRUCT], arg ptr[inout, dvd_authinfo]) 72 73 ioctl$CDROM_SEND_PACKET(fd fd_cdrom, cmd const[CDROM_SEND_PACKET], arg ptr[inout, cdrom_generic_command]) 74 75 ioctl$CDROM_NEXT_WRITABLE(fd fd_cdrom, cmd const[CDROM_NEXT_WRITABLE], arg ptr[out, int64]) 76 ioctl$CDROM_LAST_WRITTEN(fd fd_cdrom, cmd const[CDROM_LAST_WRITTEN], arg ptr[out, int64]) 77 78 type cdrom_output_buffer array[int8, CD_FRAMESIZE_RAWER] 79 80 cdrom_msf { 81 cdmsf_min0 int8 82 cdmsf_sec0 int8 83 cdmsf_frame0 int8 84 cdmsf_min1 int8 85 cdmsf_sec1 int8 86 cdmsf_frame1 int8 87 } 88 89 cdrom_msf_out_stub { 90 cdmsf_min0 int8 91 cdmsf_sec0 int8 92 cdmsf_frame0 int8 93 cdmsf_min1 int8 94 cdmsf_sec1 int8 95 cdmsf_frame1 int8 96 reserved array[const[0, int8], CDROM_MSF_OUT_STUB_SIZE] 97 } 98 99 cdrom_ti { 100 cdti_trk0 int8 101 cdti_int0 int8 102 cdti_trk1 int8 103 cdti_ind1 int8 104 } 105 106 cdrom_tochdr { 107 cdth_trk0 int8 108 cdth_trk1 int8 109 } 110 111 cdrom_tocentry { 112 cdte_track int8 113 cdte_adr int8:4 114 cdte_ctrl int8:4 115 cdte_format flags[cdrom_format, int8] 116 cdte_addr cdrom_addr 117 cdte_datamode int8 118 } 119 120 cdrom_addr [ 121 msf cdrom_msf0 122 lba int32 123 ] 124 125 cdrom_msf0 { 126 minute int8 127 second int8 128 frame int8 129 } 130 131 cdrom_read_audio { 132 addr cdrom_addr 133 addr_format flags[cdrom_format, int8] 134 nframes bytesize[buf, int32] 135 buf ptr[out, array[int8, 1:CD_FRAMES]] 136 } 137 138 cdrom_volctrl { 139 channel0 int8 140 channel1 int8 141 channel2 int8 142 channel3 int8 143 } 144 145 cdrom_subchnl { 146 cdsc_format flags[cdrom_format, int8] 147 cdsc_audiostatus int8 148 cdsc_adr int8:4 149 cdsc_ctrl int8:4 150 cdsc_trk int8 151 cdsc_ind int8 152 cdsc_absaddr cdrom_addr 153 cdsc_reladdr cdrom_addr 154 } 155 156 cdrom_multisession { 157 addr cdrom_addr 158 xa_flag bool8 159 addr_format flags[cdrom_format, int8] 160 } 161 162 cdrom_mcn { 163 medium_catalog_number array[int8, 14] 164 } 165 166 cdrom_blk { 167 from int32 168 len int16 169 } 170 171 dvd_struct [ 172 type flags[dvd_struct_type, int8] 173 174 physical dvd_physical 175 copyright dvd_copyright 176 disckey dvd_disckey 177 bca dvd_bca 178 manufact dvd_manufact 179 ] 180 181 dvd_physical { 182 type const[DVD_STRUCT_PHYSICAL, int8] 183 layer_num int8[0:3] 184 layer array[dvd_layer, DVD_LAYERS] 185 } 186 187 dvd_layer { 188 book_version int8:4 189 book_type int8:4 190 min_rate int8:4 191 disc_size int8:4 192 layer_type int8:4 193 track_path int8:1 194 nlayers int8:2 195 track_density int8:4 196 linear_density int8:4 197 bca int8:1 198 start_sector int32 199 end_sector int32 200 end_sector_l0 int32 201 } 202 203 dvd_copyright { 204 type const[DVD_STRUCT_COPYRIGHT, int8] 205 206 layer_num int8[0:3] 207 cpst int8 208 rmi int8 209 } 210 211 dvd_disckey { 212 type const[DVD_STRUCT_DISCKEY, int8] 213 214 agid int32:2 215 value array[int8, 2048] 216 } 217 218 dvd_bca { 219 type const[DVD_STRUCT_BCA, int8] 220 221 len len[value, int32] 222 value array[int8, 188] 223 } 224 225 dvd_manufact { 226 type const[DVD_STRUCT_MANUFACT, int8] 227 228 layer_num int8[0:3] 229 len len[value, int32] 230 value array[int8, 2048] 231 } 232 233 dvd_authinfo [ 234 type flags[dvd_authinfo_type, int8] 235 236 lsa dvd_lu_send_agid 237 hsc dvd_host_send_challenge 238 lsk dvd_send_key 239 lsc dvd_lu_send_challenge 240 hsk dvd_send_key 241 lstk dvd_lu_send_title_key 242 lsasf dvd_lu_send_asf 243 hrpcs dvd_host_send_rpcstate 244 lrpcs dvd_lu_send_rpcstate 245 ] 246 247 type dvd_key array[int8, 5] 248 type dvd_challenge array[int8, 10] 249 250 dvd_lu_send_agid { 251 type const[DVD_LU_SEND_AGID, int8] 252 agid int32:2 253 } 254 255 dvd_host_send_challenge { 256 type const[DVD_HOST_SEND_CHALLENGE, int8] 257 agid int32:2 258 259 chal dvd_challenge 260 } 261 262 dvd_send_key_type = DVD_LU_SEND_KEY1, DVD_HOST_SEND_KEY2 263 264 dvd_send_key { 265 type flags[dvd_send_key_type, int8] 266 agid int32:2 267 268 key dvd_key 269 } 270 271 dvd_lu_send_challenge { 272 type const[DVD_LU_SEND_CHALLENGE, int8] 273 agid int32:2 274 275 chal dvd_challenge 276 } 277 278 dvd_lu_send_title_key { 279 type const[DVD_LU_SEND_TITLE_KEY, int8] 280 agid int32:2 281 282 title_key dvd_key 283 lba int32 284 cpm int32:1 285 cp_sec int32:1 286 cgms int32:2 287 } 288 289 dvd_lu_send_asf { 290 type const[DVD_LU_SEND_ASF, int8] 291 agid int32:2 292 293 asf int32:1 294 } 295 296 dvd_host_send_rpcstate { 297 type const[DVD_HOST_SEND_RPC_STATE, int8] 298 pdrc int8 299 } 300 301 dvd_lu_send_rpcstate { 302 type int8:2 303 vra int8:3 304 ucca int8:3 305 region_mask int8 306 rpc_scheme int8 307 } 308 309 cdrom_generic_command { 310 cmd array[int8, CDROM_PACKET_SIZE] 311 buffer ptr[inout, array[int8]] 312 buflen len[buffer, int32] 313 stat int32 314 sense ptr[inout, request_sense] 315 data_direction flags[cdrom_data_direction, int8] 316 quiet int32 317 timeout int32 318 reserved ptr[out, array[intptr, 1]] 319 } 320 321 request_sense { 322 error_code int8:7 323 valid int8:1 324 segment_number int8 325 sense_key int8:4 326 reserved2 const[0, int8:1] 327 ili int8:1 328 reserved1 const[0, int8:2] 329 information array[int8, 4] 330 add_sense_len int8 331 command_info array[int8, 4] 332 asc int8 333 ascq int8 334 fruc int8 335 sks array[int8, 3] 336 asb array[int8, 46] 337 } 338 339 cdrom_timed_media_change_info { 340 last_media_change int64 341 media_flags flags[media_flags, int64] 342 } 343 344 cdrom_options = CDO_AUTO_CLOSE, CDO_AUTO_EJECT, CDO_USE_FFLAGS, CDO_LOCK, CDO_CHECK_TYPE 345 cdrom_format = CDROM_MSF, CDROM_LBA 346 dvd_struct_type = DVD_STRUCT_PHYSICAL, DVD_STRUCT_COPYRIGHT, DVD_STRUCT_DISCKEY, DVD_STRUCT_BCA, DVD_STRUCT_MANUFACT 347 dvd_authinfo_type = DVD_LU_SEND_AGID, DVD_LU_SEND_KEY1, DVD_LU_SEND_CHALLENGE, DVD_LU_SEND_TITLE_KEY, DVD_LU_SEND_ASF, DVD_HOST_SEND_CHALLENGE, DVD_HOST_SEND_KEY2, DVD_INVALIDATE_AGID, DVD_LU_SEND_RPC_STATE, DVD_LU_SEND_RPC_STATE 348 cdrom_data_direction = CGC_DATA_UNKNOWN, CGC_DATA_WRITE, CGC_DATA_READ, CGC_DATA_NONE 349 media_flags = MEDIA_CHANGED_FLAG 350 351 define CDROM_MSF_OUT_STUB_SIZE CD_FRAMESIZE_RAWER-6