github.com/google/syzkaller@v0.0.0-20240517125934-c0f1611a36d6/pkg/flatrpc/flatrpc.fbs (about) 1 // Copyright 2024 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 namespace rpc; 5 6 enum Feature : uint64 (bit_flags) { 7 Coverage, 8 Comparisons, 9 ExtraCoverage, 10 DelayKcovMmap, 11 SandboxSetuid, 12 SandboxNamespace, 13 SandboxAndroid, 14 Fault, 15 Leak, 16 NetInjection, 17 NetDevices, 18 KCSAN, 19 DevlinkPCI, 20 NicVF, 21 USBEmulation, 22 VhciInjection, 23 WifiEmulation, 24 LRWPANEmulation, // 802.15.4 standard 25 BinFmtMisc, 26 Swap, 27 } 28 29 table ConnectRequestRaw { 30 name :string; 31 arch :string; 32 git_revision :string; 33 syz_revision :string; 34 } 35 36 table ConnectReplyRaw { 37 leak_frames :[string]; 38 race_frames :[string]; 39 // Fuzzer sets up these features and returns results in InfoRequest.features. 40 features :Feature; 41 // Fuzzer reads these files inside of the VM and returns contents in InfoRequest.files. 42 files :[string]; 43 globs :[string]; 44 } 45 46 table InfoRequestRaw { 47 error :string; 48 features :[FeatureInfoRaw]; 49 files :[FileInfoRaw]; 50 globs :[GlobInfoRaw]; 51 } 52 53 table InfoReplyRaw { 54 cover_filter :[uint8]; 55 } 56 57 table FileInfoRaw { 58 name :string; 59 exists :bool; 60 error :string; 61 data :[uint8]; 62 } 63 64 table GlobInfoRaw { 65 name :string; 66 files :[string]; 67 } 68 69 table FeatureInfoRaw { 70 id :Feature; 71 need_setup :bool; 72 reason :string; 73 } 74 75 // Messages sent from the host to the executor. 76 union HostMessagesRaw { 77 ExecRequest :ExecRequestRaw, 78 SignalUpdate :SignalUpdateRaw, 79 } 80 81 table HostMessageRaw { 82 msg :HostMessagesRaw; 83 } 84 85 // Messages sent from the executor to the host. 86 union ExecutorMessagesRaw { 87 ExecResult :ExecResultRaw, 88 Executing :ExecutingMessageRaw, 89 } 90 91 table ExecutorMessageRaw { 92 msg :ExecutorMessagesRaw; 93 } 94 95 enum RequestFlag : uint64 (bit_flags) { 96 // If set, prog_data contains compiled executable binary 97 // that needs to be written to disk and executed. 98 IsBinary, 99 // Return only new signal rather than all signal. 100 NewSignal, 101 // If set, fully reset executor state befor executing the test. 102 ResetState, 103 // If set, collect program output and return in output field. 104 ReturnOutput, 105 // If set, don't fail on program failures, instead return the error in error field. 106 ReturnError, 107 } 108 109 // Note: New / changed flags should be added to parse_env_flags in executor.cc. 110 enum ExecEnv : uint64 (bit_flags) { 111 Debug, // debug output from executor 112 Signal, // collect feedback signals (coverage) 113 SandboxSetuid, // impersonate nobody user 114 SandboxNamespace, // use namespaces for sandboxing 115 SandboxAndroid, // use Android sandboxing for the untrusted_app domain 116 ExtraCover, // collect extra coverage 117 EnableTun, // setup and use /dev/tun for packet injection 118 EnableNetDev, // setup more network devices for testing 119 EnableNetReset, // reset network namespace between programs 120 EnableCgroups, // setup cgroups for testing 121 EnableCloseFds, // close fds after each program 122 EnableDevlinkPCI, // setup devlink PCI device 123 EnableVhciInjection, // setup and use /dev/vhci for hci packet injection 124 EnableWifi, // setup and use mac80211_hwsim for wifi emulation 125 DelayKcovMmap, // manage kcov memory in an optimized way 126 EnableNicVF, // setup NIC VF device 127 } 128 129 enum ExecFlag : uint64 (bit_flags) { 130 CollectSignal, // collect feedback signals 131 CollectCover, // collect coverage 132 DedupCover, // deduplicate coverage in executor 133 CollectComps, // collect KCOV comparisons 134 Threaded, // use multiple threads to mitigate blocked syscalls 135 CoverFilter, // setup and use bitmap to do coverage filter 136 } 137 138 // Request to execute a test program. 139 table ExecRequestRaw { 140 id :int64; 141 prog_data :[uint8]; 142 flags :RequestFlag; 143 exec_env :ExecEnv; 144 exec_flags :ExecFlag; 145 sandbox_arg :int64; 146 signal_filter :[uint32]; 147 signal_filter_call :int32; 148 // Repeat the program that many times (0 means 1). 149 repeat :int32; 150 } 151 152 table SignalUpdateRaw { 153 new_max :[uint32]; 154 drop_max :[uint32]; 155 } 156 157 // Notification from the executor that it started executing the program 'id'. 158 // We want this request to be as small and as fast as possible b/c we need it 159 // to reach the host (or at least leave the VM) before the VM crashes 160 // executing this program. 161 table ExecutingMessageRaw { 162 id :int64; 163 proc_id :int32; 164 try :int32; 165 // How long proc waited to receive the request (ns). 166 wait_duration :int64; 167 } 168 169 enum CallFlag : uint8 (bit_flags) { 170 Executed, // was started at all 171 Finished, // finished executing (rather than blocked forever) 172 Blocked, // finished but blocked during execution 173 FaultInjected, // fault was injected into this call 174 } 175 176 table CallInfoRaw { 177 flags :CallFlag; 178 // Call errno (0 if the call was successful). 179 error :int32; 180 // Feedback signal, filled if ExecFlag.CollectSignal is set. 181 signal :[uint32]; 182 // Code coverage, filled if ExecFlag.CollectCover is set. 183 // If ExecFlag.DedupCover is set, then duplicates are removed, otherwise it contains a trace. 184 cover :[uint32]; 185 // Comparison operands. 186 comps :[ComparisonRaw]; 187 } 188 189 struct ComparisonRaw { 190 op1 :uint64; 191 op2 :uint64; 192 } 193 194 table ProgInfoRaw { 195 calls :[CallInfoRaw]; 196 // Contains signal and cover collected from background threads. 197 extra :CallInfoRaw; 198 // Total execution time of the program in nanoseconds. 199 elapsed :uint64; 200 // Number of programs executed in the same process before this one. 201 freshness :uint64; 202 } 203 204 // Result of executing a test program. 205 table ExecResultRaw { 206 id :int64; 207 output :[uint8]; 208 error :string; 209 info :ProgInfoRaw; 210 }