github.com/google/syzkaller@v0.0.0-20240517125934-c0f1611a36d6/sys/linux/fs_9p.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 # 9p2000 mount/server descriptions. For protocol description see: 5 # http://knusbaum.com/useful/rfc9p2000 6 # http://ericvh.github.io/9p-rfc/rfc9p2000.html 7 # http://ericvh.github.io/9p-rfc/rfc9p2000.u.html 8 # https://github.com/chaos/diod/blob/master/protocol.md 9 10 include <linux/fs.h> 11 include <net/9p/9p.h> 12 13 resource rfd9p[fd] 14 resource wfd9p[fd] 15 16 mount$9p_fd(src const[0], dst ptr[in, filename], type ptr[in, string["9p"]], flags flags[mount_flags], opts ptr[in, p9_options_fd]) 17 mount$9p_tcp(src ptr[in, string["127.0.0.1"]], dst ptr[in, filename], type ptr[in, string["9p"]], flags flags[mount_flags], opts ptr[in, p9_options_tcp]) 18 mount$9p_unix(src ptr[in, filename], dst ptr[in, filename], type ptr[in, string["9p"]], flags flags[mount_flags], opts ptr[in, p9_options_unix]) 19 mount$9p_rdma(src ptr[in, string["127.0.0.1"]], dst ptr[in, filename], type ptr[in, string["9p"]], flags flags[mount_flags], opts ptr[in, p9_options_rdma]) 20 mount$9p_virtio(src ptr[in, string["syz"]], dst ptr[in, filename], type ptr[in, string["9p"]], flags flags[mount_flags], opts ptr[in, p9_options_virtio]) 21 mount$9p_xen(src ptr[in, string["syz"]], dst ptr[in, filename], type ptr[in, string["9p"]], flags flags[mount_flags], opts ptr[in, p9_options_xen]) 22 23 pipe2$9p(pipefd ptr[out, pipe_9p], flags flags[pipe_flags]) 24 25 pipe_9p { 26 rfd rfd9p 27 wfd wfd9p 28 } 29 30 write$9p(fd wfd9p, data ptr[in, array[int8]], size bytesize[data]) 31 32 write$P9_RLERROR(fd wfd9p, data ptr[in, p9_msg[P9_RLERROR, p9_rerror]], size bytesize[data]) 33 write$P9_RLERRORu(fd wfd9p, data ptr[in, p9_msg[P9_RLERROR, p9_rerroru]], size bytesize[data]) 34 write$P9_RVERSION(fd wfd9p, data ptr[in, p9_rversion], size bytesize[data]) 35 write$P9_RAUTH(fd wfd9p, data ptr[in, p9_msg[P9_RAUTH, p9_qid]], size bytesize[data]) 36 write$P9_RFLUSH(fd wfd9p, data ptr[in, p9_msg[P9_RFLUSH, void]], size bytesize[data]) 37 write$P9_RATTACH(fd wfd9p, data ptr[in, p9_msg[P9_RATTACH, p9_qid]], size bytesize[data]) 38 write$P9_RWALK(fd wfd9p, data ptr[in, p9_msg[P9_RWALK, p9_rwalk]], size bytesize[data]) 39 write$P9_ROPEN(fd wfd9p, data ptr[in, p9_msg[P9_ROPEN, p9_ropen]], size bytesize[data]) 40 write$P9_RCREATE(fd wfd9p, data ptr[in, p9_msg[P9_RCREATE, p9_ropen]], size bytesize[data]) 41 write$P9_RREAD(fd wfd9p, data ptr[in, p9_msg[P9_RREAD, p9_rread]], size bytesize[data]) 42 write$P9_RWRITE(fd wfd9p, data ptr[in, p9_msg[P9_RWRITE, int32]], size bytesize[data]) 43 write$P9_RCLUNK(fd wfd9p, data ptr[in, p9_msg[P9_RCLUNK, void]], size bytesize[data]) 44 write$P9_RREMOVE(fd wfd9p, data ptr[in, p9_msg[P9_RREMOVE, void]], size bytesize[data]) 45 write$P9_RWSTAT(fd wfd9p, data ptr[in, p9_msg[P9_RWSTAT, void]], size bytesize[data]) 46 write$P9_RSTAT(fd wfd9p, data ptr[in, p9_msg[P9_RSTAT, p9_rstat]], size bytesize[data]) 47 write$P9_RSTATu(fd wfd9p, data ptr[in, p9_msg[P9_RSTAT, p9_rstatu]], size bytesize[data]) 48 write$P9_RSTATFS(fd wfd9p, data ptr[in, p9_msg[P9_RSTATFS, p9_rstatfs]], size bytesize[data]) 49 write$P9_RLOPEN(fd wfd9p, data ptr[in, p9_msg[P9_RLOPEN, p9_ropen]], size bytesize[data]) 50 write$P9_RLCREATE(fd wfd9p, data ptr[in, p9_msg[P9_RLCREATE, p9_ropen]], size bytesize[data]) 51 write$P9_RSYMLINK(fd wfd9p, data ptr[in, p9_msg[P9_RSYMLINK, p9_qid]], size bytesize[data]) 52 write$P9_RMKNOD(fd wfd9p, data ptr[in, p9_msg[P9_RMKNOD, p9_qid]], size bytesize[data]) 53 write$P9_RRENAME(fd wfd9p, data ptr[in, p9_msg[P9_RRENAME, void]], size bytesize[data]) 54 write$P9_RREADLINK(fd wfd9p, data ptr[in, p9_msg[P9_RREADLINK, p9_rreadlink]], size bytesize[data]) 55 write$P9_RGETATTR(fd wfd9p, data ptr[in, p9_msg[P9_RGETATTR, p9_rgetattr]], size bytesize[data]) 56 write$P9_RSETATTR(fd wfd9p, data ptr[in, p9_msg[P9_RSETATTR, void]], size bytesize[data]) 57 write$P9_RXATTRWALK(fd wfd9p, data ptr[in, p9_msg[P9_RXATTRWALK, int64]], size bytesize[data]) 58 write$P9_RXATTRCREATE(fd wfd9p, data ptr[in, p9_msg[P9_RXATTRCREATE, void]], size bytesize[data]) 59 write$P9_RREADDIR(fd wfd9p, data ptr[in, p9_msg[P9_RREADDIR, p9_rreaddir]], size bytesize[data]) 60 write$P9_RFSYNC(fd wfd9p, data ptr[in, p9_msg[P9_RFSYNC, void]], size bytesize[data]) 61 write$P9_RLOCK(fd wfd9p, data ptr[in, p9_msg[P9_RLOCK, flags[p9_lock_status, int8]]], size bytesize[data]) 62 write$P9_RGETLOCK(fd wfd9p, data ptr[in, p9_msg[P9_RGETLOCK, p9_rgetlock]], size bytesize[data]) 63 write$P9_RLINK(fd wfd9p, data ptr[in, p9_msg[P9_RLINK, void]], size bytesize[data]) 64 write$P9_RMKDIR(fd wfd9p, data ptr[in, p9_msg[P9_RMKDIR, p9_qid]], size bytesize[data]) 65 write$P9_RRENAMEAT(fd wfd9p, data ptr[in, p9_msg[P9_RRENAMEAT, void]], size bytesize[data]) 66 write$P9_RUNLINKAT(fd wfd9p, data ptr[in, p9_msg[P9_RUNLINKAT, void]], size bytesize[data]) 67 68 type p9_msg[MSG, PAYLOAD] { 69 size bytesize[parent, int32] 70 type const[MSG, int8] 71 tag int16[1:2] 72 payload PAYLOAD 73 } [packed] 74 75 p9_rerror { 76 ename_len len[ename, int16] 77 ename stringnoz 78 } [packed] 79 80 p9_rerroru { 81 error p9_rerror 82 errno int32 83 } [packed] 84 85 p9_rversion { 86 size bytesize[parent, int32] 87 type const[P9_RVERSION, int8] 88 tag const[0xffff, int16] 89 msize int32 90 version_len len[version, int16] 91 version stringnoz[p9_versions] 92 } [packed] 93 94 p9_versions = "9P2000", "9P2000.u", "9P2000.L" 95 96 p9_qid { 97 type flags[p9_qid_types, int8] 98 version int32[0:4] 99 path int64[0:8] 100 } [packed] 101 102 p9_qid_types = P9_QTDIR, P9_QTAPPEND, P9_QTEXCL, P9_QTMOUNT, P9_QTAUTH, P9_QTTMP, P9_QTSYMLINK, P9_QTLINK, P9_QTFILE 103 104 p9_rwalk { 105 nwqid len[wqid, int16] 106 wqid array[p9_qid] 107 } [packed] 108 109 p9_ropen { 110 qid p9_qid 111 iounit int32 112 } [packed] 113 114 p9_rread { 115 count bytesize[data, int32] 116 data array[int8] 117 } [packed] 118 119 p9_rstat { 120 # I can't find this in any protocol descriptions, but linux seems to expect another int16 field here. 121 ignored const[0, int16] 122 size bytesize[parent, int16] 123 type int16 124 dev int32 125 qid p9_qid 126 mode flags[p9_perm_t, int32] 127 atime int32 128 mtime int32 129 length int64 130 name_len len[name, int16] 131 name stringnoz 132 uid_len len[uid, int16] 133 uid stringnoz 134 gid_len len[gid, int16] 135 gid stringnoz 136 muid_len len[muid, int16] 137 muid stringnoz 138 } [packed] 139 140 p9_rstatu { 141 rstat p9_rstat 142 extension_len len[extension, int16] 143 extension stringnoz 144 n_uid uid 145 n_gid gid 146 n_muid uid 147 } [packed] 148 149 p9_perm_t = P9_DMDIR, P9_DMAPPEND, P9_DMEXCL, P9_DMMOUNT, P9_DMAUTH, P9_DMTMP, P9_DMSYMLINK, P9_DMLINK, P9_DMDEVICE, P9_DMNAMEDPIPE, P9_DMSOCKET, P9_DMSETUID, P9_DMSETGID, P9_DMSETVTX 150 151 p9_rreadlink { 152 target_len len[target, int16] 153 target stringnoz[filename] 154 } [packed] 155 156 p9_rstatfs { 157 type int32 158 bsize int32 159 blocks int64 160 bfree int64 161 bavail int64 162 files int64 163 ffree int64 164 fsid int64 165 namelen int32 166 } [packed] 167 168 p9_rgetattr { 169 valid flags[p8_stats_valid, int64] 170 qid p9_qid 171 mode flags[open_mode, int32] 172 uid uid 173 gid gid 174 nlink int64 175 rdev int64 176 size int64 177 blksize int64 178 blocks int64 179 atime_sec int64 180 atime_nsec int64 181 mtime_sec int64 182 mtime_nsec int64 183 ctime_sec int64 184 ctime_nsec int64 185 btime_sec int64 186 btime_nsec int64 187 gen int64 188 data_version int64 189 } [packed] 190 191 p8_stats_valid = P9_STATS_MODE, P9_STATS_NLINK, P9_STATS_UID, P9_STATS_GID, P9_STATS_RDEV, P9_STATS_ATIME, P9_STATS_MTIME, P9_STATS_CTIME, P9_STATS_INO, P9_STATS_SIZE, P9_STATS_BLOCKS, P9_STATS_BTIME, P9_STATS_GEN, P9_STATS_DATA_VERSION 192 193 p9_lock_status = P9_LOCK_SUCCESS, P9_LOCK_BLOCKED, P9_LOCK_ERROR, P9_LOCK_GRACE 194 p9_lock_type = P9_LOCK_TYPE_RDLCK, P9_LOCK_TYPE_WRLCK, P9_LOCK_TYPE_UNLCK 195 196 p9_rreaddir { 197 count int32 198 entries array[p9_dir] 199 } [packed] 200 201 p9_dir { 202 qid p9_qid 203 offset int64 204 type int8 205 name_len len[name, int16] 206 name stringnoz[filename] 207 } [packed] 208 209 p9_rgetlock { 210 type flags[p9_lock_type, int8] 211 start int64 212 length int64 213 proc_id pid 214 client_id_len len[client_id, int16] 215 client_id stringnoz 216 } [packed] 217 218 # Mount options. 219 220 p9_options_fd { 221 trans stringnoz["trans=fd,"] 222 rfdno fs_opt_hex["rfdno", rfd9p] 223 comma0 const[',', int8] 224 wfdno fs_opt_hex["wfdno", fd] 225 comma1 const[',', int8] 226 opts fs_options[p9_options] 227 } [packed] 228 229 p9_options_tcp { 230 trans stringnoz["trans=tcp,"] 231 port fs_opt_hex["port", sock_port] 232 comma0 const[',', int8] 233 opts fs_options[p9_options] 234 } [packed] 235 236 p9_options_unix { 237 name stringnoz["trans=unix,"] 238 opts fs_options[p9_options] 239 } [packed] 240 241 p9_options_rdma { 242 trans stringnoz["trans=rdma,"] 243 port fs_opt_hex["port", sock_port] 244 comma0 const[',', int8] 245 opts fs_options[p9_options_rdma_opt] 246 } [packed] 247 248 p9_options_rdma_opt [ 249 common p9_options 250 timeout fs_opt_hex["timeout", intptr] 251 sq fs_opt_hex["sq", intptr] 252 rq fs_opt_hex["rq", intptr] 253 ] [varlen] 254 255 p9_options_virtio { 256 trans stringnoz["trans=virtio,"] 257 opts fs_options[p9_options] 258 } [packed] 259 260 p9_options_xen { 261 trans stringnoz["trans=xen,"] 262 opts fs_options[p9_options] 263 } [packed] 264 265 p9_options [ 266 uname fs_opt_str["uname"] 267 aname fs_opt_str["aname"] 268 cache_none stringnoz["cache=none"] 269 cache_loose stringnoz["cache=loose"] 270 cache_fscache stringnoz["cache=fscache"] 271 cache_mmap stringnoz["cache=mmap"] 272 debug fs_opt_hex["debug", int64] 273 noextend stringnoz["noextend"] 274 nodevmap stringnoz["nodevmap"] 275 version_9p2000 stringnoz["version=9p2000"] 276 version_u stringnoz["version=9p2000.u"] 277 version_L stringnoz["version=9p2000.L"] 278 cachetag fs_opt_str["cachetag"] 279 loose stringnoz["loose"] 280 fscache stringnoz["fscache"] 281 mmap stringnoz["mmap"] 282 posixacl stringnoz["posixacl"] 283 privport stringnoz["privport"] 284 msize fs_opt_hex["msize", int32] 285 dfltuid fs_opt_hex["dfltuid", uid] 286 dfltgid fs_opt_hex["dfltgid", gid] 287 afid fs_opt_hex["afid", int32] 288 access_user stringnoz["access=user"] 289 access_any stringnoz["access=any"] 290 access_client stringnoz["access=client"] 291 access_uid fs_opt_dec["access", uid] 292 ] [varlen]