Elliott Hughes | df2e7eb | 2022-09-12 22:24:18 +0000 | [diff] [blame] | 1 | // |
| 2 | // Protobuf definition for Android tombstones. |
| 3 | // |
| 4 | // An app can get hold of these for any `REASON_CRASH_NATIVE` instance of |
| 5 | // `android.app.ApplicationExitInfo`. |
| 6 | // |
| 7 | // https://developer.android.com/reference/android/app/ApplicationExitInfo#getTraceInputStream() |
| 8 | // |
| 9 | |
Josh Gao | 76e1e30 | 2021-01-26 15:53:11 -0800 | [diff] [blame] | 10 | syntax = "proto3"; |
| 11 | |
Josh Gao | d3df0ae | 2021-02-01 14:35:30 -0800 | [diff] [blame] | 12 | option java_package = "com.android.server.os"; |
| 13 | option java_outer_classname = "TombstoneProtos"; |
| 14 | |
Josh Gao | fc4fb21 | 2021-02-10 16:59:50 -0800 | [diff] [blame] | 15 | // NOTE TO OEMS: |
| 16 | // If you add custom fields to this proto, do not use numbers in the reserved range. |
| 17 | |
Florian Mayer | 5fa6663 | 2024-02-07 16:42:23 -0800 | [diff] [blame] | 18 | message CrashDetail { |
| 19 | bytes name = 1; |
| 20 | bytes data = 2; |
Florian Mayer | f247437 | 2024-05-31 22:35:25 +0000 | [diff] [blame] | 21 | |
| 22 | reserved 3 to 999; |
Florian Mayer | 5fa6663 | 2024-02-07 16:42:23 -0800 | [diff] [blame] | 23 | } |
| 24 | |
Florian Mayer | e3e7bc7 | 2024-04-26 09:38:50 -0700 | [diff] [blame] | 25 | message StackHistoryBufferEntry { |
| 26 | BacktraceFrame addr = 1; |
| 27 | uint64 fp = 2; |
| 28 | uint64 tag = 3; |
| 29 | |
| 30 | reserved 4 to 999; |
| 31 | } |
| 32 | |
| 33 | message StackHistoryBuffer { |
| 34 | uint64 tid = 1; |
| 35 | repeated StackHistoryBufferEntry entries = 2; |
| 36 | |
| 37 | reserved 3 to 999; |
| 38 | } |
| 39 | |
Josh Gao | 76e1e30 | 2021-01-26 15:53:11 -0800 | [diff] [blame] | 40 | message Tombstone { |
| 41 | Architecture arch = 1; |
Sijie Chen | c802793 | 2024-05-10 18:40:48 +0000 | [diff] [blame] | 42 | Architecture guest_arch = 24; |
Josh Gao | 76e1e30 | 2021-01-26 15:53:11 -0800 | [diff] [blame] | 43 | string build_fingerprint = 2; |
| 44 | string revision = 3; |
| 45 | string timestamp = 4; |
| 46 | |
| 47 | uint32 pid = 5; |
| 48 | uint32 tid = 6; |
| 49 | uint32 uid = 7; |
| 50 | string selinux_label = 8; |
| 51 | |
Josh Gao | 31348a7 | 2021-03-29 21:53:42 -0700 | [diff] [blame] | 52 | repeated string command_line = 9; |
Josh Gao | 76e1e30 | 2021-01-26 15:53:11 -0800 | [diff] [blame] | 53 | |
Josh Gao | dbb83de | 2021-03-01 23:13:13 -0800 | [diff] [blame] | 54 | // Process uptime in seconds. |
| 55 | uint32 process_uptime = 20; |
| 56 | |
Josh Gao | 76e1e30 | 2021-01-26 15:53:11 -0800 | [diff] [blame] | 57 | Signal signal_info = 10; |
| 58 | string abort_message = 14; |
Florian Mayer | 5fa6663 | 2024-02-07 16:42:23 -0800 | [diff] [blame] | 59 | repeated CrashDetail crash_details = 21; |
Peter Collingbourne | 1a1f7d7 | 2021-03-08 16:53:54 -0800 | [diff] [blame] | 60 | repeated Cause causes = 15; |
Josh Gao | 76e1e30 | 2021-01-26 15:53:11 -0800 | [diff] [blame] | 61 | |
| 62 | map<uint32, Thread> threads = 16; |
Sijie Chen | c802793 | 2024-05-10 18:40:48 +0000 | [diff] [blame] | 63 | map<uint32, Thread> guest_threads = 25; |
Josh Gao | 76e1e30 | 2021-01-26 15:53:11 -0800 | [diff] [blame] | 64 | repeated MemoryMapping memory_mappings = 17; |
| 65 | repeated LogBuffer log_buffers = 18; |
| 66 | repeated FD open_fds = 19; |
Josh Gao | fc4fb21 | 2021-02-10 16:59:50 -0800 | [diff] [blame] | 67 | |
Devin Moore | 4647b6b | 2024-05-03 00:02:24 +0000 | [diff] [blame] | 68 | uint32 page_size = 22; |
| 69 | bool has_been_16kb_mode = 23; |
| 70 | |
Florian Mayer | e3e7bc7 | 2024-04-26 09:38:50 -0700 | [diff] [blame] | 71 | StackHistoryBuffer stack_history_buffer = 26; |
| 72 | |
| 73 | reserved 27 to 999; |
Josh Gao | 76e1e30 | 2021-01-26 15:53:11 -0800 | [diff] [blame] | 74 | } |
| 75 | |
| 76 | enum Architecture { |
| 77 | ARM32 = 0; |
| 78 | ARM64 = 1; |
| 79 | X86 = 2; |
| 80 | X86_64 = 3; |
Liu Cunyuan | 8c0101b | 2022-10-12 22:35:51 +0800 | [diff] [blame] | 81 | RISCV64 = 4; |
Sijie Chen | c802793 | 2024-05-10 18:40:48 +0000 | [diff] [blame] | 82 | NONE = 5; |
Josh Gao | fc4fb21 | 2021-02-10 16:59:50 -0800 | [diff] [blame] | 83 | |
Sijie Chen | c802793 | 2024-05-10 18:40:48 +0000 | [diff] [blame] | 84 | reserved 6 to 999; |
Josh Gao | 76e1e30 | 2021-01-26 15:53:11 -0800 | [diff] [blame] | 85 | } |
| 86 | |
| 87 | message Signal { |
| 88 | int32 number = 1; |
| 89 | string name = 2; |
| 90 | |
| 91 | int32 code = 3; |
| 92 | string code_name = 4; |
| 93 | |
| 94 | bool has_sender = 5; |
| 95 | int32 sender_uid = 6; |
| 96 | int32 sender_pid = 7; |
| 97 | |
| 98 | bool has_fault_address = 8; |
| 99 | uint64 fault_address = 9; |
Mitch Phillips | 5ddcea2 | 2021-04-19 09:59:17 -0700 | [diff] [blame] | 100 | // Note, may or may not contain the dump of the actual memory contents. Currently, on arm64, we |
| 101 | // only include metadata, and not the contents. |
| 102 | MemoryDump fault_adjacent_metadata = 10; |
Josh Gao | fc4fb21 | 2021-02-10 16:59:50 -0800 | [diff] [blame] | 103 | |
Mitch Phillips | 5ddcea2 | 2021-04-19 09:59:17 -0700 | [diff] [blame] | 104 | reserved 11 to 999; |
Josh Gao | 76e1e30 | 2021-01-26 15:53:11 -0800 | [diff] [blame] | 105 | } |
| 106 | |
Peter Collingbourne | 1a1f7d7 | 2021-03-08 16:53:54 -0800 | [diff] [blame] | 107 | message HeapObject { |
| 108 | uint64 address = 1; |
| 109 | uint64 size = 2; |
| 110 | |
| 111 | uint64 allocation_tid = 3; |
| 112 | repeated BacktraceFrame allocation_backtrace = 4; |
| 113 | |
| 114 | uint64 deallocation_tid = 5; |
| 115 | repeated BacktraceFrame deallocation_backtrace = 6; |
| 116 | } |
| 117 | |
| 118 | message MemoryError { |
| 119 | enum Tool { |
| 120 | GWP_ASAN = 0; |
| 121 | SCUDO = 1; |
| 122 | |
| 123 | reserved 2 to 999; |
| 124 | } |
| 125 | Tool tool = 1; |
| 126 | |
| 127 | enum Type { |
| 128 | UNKNOWN = 0; |
| 129 | USE_AFTER_FREE = 1; |
| 130 | DOUBLE_FREE = 2; |
| 131 | INVALID_FREE = 3; |
| 132 | BUFFER_OVERFLOW = 4; |
| 133 | BUFFER_UNDERFLOW = 5; |
| 134 | |
| 135 | reserved 6 to 999; |
| 136 | } |
| 137 | Type type = 2; |
| 138 | |
| 139 | oneof location { |
| 140 | HeapObject heap = 3; |
| 141 | } |
| 142 | |
| 143 | reserved 4 to 999; |
| 144 | } |
| 145 | |
Josh Gao | 76e1e30 | 2021-01-26 15:53:11 -0800 | [diff] [blame] | 146 | message Cause { |
| 147 | string human_readable = 1; |
Peter Collingbourne | 1a1f7d7 | 2021-03-08 16:53:54 -0800 | [diff] [blame] | 148 | oneof details { |
| 149 | MemoryError memory_error = 2; |
| 150 | } |
Josh Gao | fc4fb21 | 2021-02-10 16:59:50 -0800 | [diff] [blame] | 151 | |
Peter Collingbourne | 1a1f7d7 | 2021-03-08 16:53:54 -0800 | [diff] [blame] | 152 | reserved 3 to 999; |
Josh Gao | 76e1e30 | 2021-01-26 15:53:11 -0800 | [diff] [blame] | 153 | } |
| 154 | |
| 155 | message Register { |
| 156 | string name = 1; |
| 157 | uint64 u64 = 2; |
Josh Gao | fc4fb21 | 2021-02-10 16:59:50 -0800 | [diff] [blame] | 158 | |
| 159 | reserved 3 to 999; |
Josh Gao | 76e1e30 | 2021-01-26 15:53:11 -0800 | [diff] [blame] | 160 | } |
| 161 | |
| 162 | message Thread { |
| 163 | int32 id = 1; |
| 164 | string name = 2; |
| 165 | repeated Register registers = 3; |
Christopher Ferris | fe751c5 | 2021-04-16 09:40:40 -0700 | [diff] [blame] | 166 | repeated string backtrace_note = 7; |
Christopher Ferris | c95047d | 2022-03-14 15:02:11 -0700 | [diff] [blame] | 167 | repeated string unreadable_elf_files = 9; |
Josh Gao | 76e1e30 | 2021-01-26 15:53:11 -0800 | [diff] [blame] | 168 | repeated BacktraceFrame current_backtrace = 4; |
| 169 | repeated MemoryDump memory_dump = 5; |
Peter Collingbourne | 1a1f7d7 | 2021-03-08 16:53:54 -0800 | [diff] [blame] | 170 | int64 tagged_addr_ctrl = 6; |
Elliott Hughes | d13ea52 | 2022-01-13 09:20:26 -0800 | [diff] [blame] | 171 | int64 pac_enabled_keys = 8; |
Josh Gao | fc4fb21 | 2021-02-10 16:59:50 -0800 | [diff] [blame] | 172 | |
Christopher Ferris | c95047d | 2022-03-14 15:02:11 -0700 | [diff] [blame] | 173 | reserved 10 to 999; |
Josh Gao | 76e1e30 | 2021-01-26 15:53:11 -0800 | [diff] [blame] | 174 | } |
| 175 | |
| 176 | message BacktraceFrame { |
| 177 | uint64 rel_pc = 1; |
| 178 | uint64 pc = 2; |
| 179 | uint64 sp = 3; |
| 180 | |
| 181 | string function_name = 4; |
| 182 | uint64 function_offset = 5; |
| 183 | |
| 184 | string file_name = 6; |
| 185 | uint64 file_map_offset = 7; |
| 186 | string build_id = 8; |
Josh Gao | fc4fb21 | 2021-02-10 16:59:50 -0800 | [diff] [blame] | 187 | |
| 188 | reserved 9 to 999; |
Josh Gao | 76e1e30 | 2021-01-26 15:53:11 -0800 | [diff] [blame] | 189 | } |
| 190 | |
Mitch Phillips | 5ddcea2 | 2021-04-19 09:59:17 -0700 | [diff] [blame] | 191 | message ArmMTEMetadata { |
| 192 | // One memory tag per granule (e.g. every 16 bytes) of regular memory. |
| 193 | bytes memory_tags = 1; |
| 194 | reserved 2 to 999; |
| 195 | } |
| 196 | |
Josh Gao | 76e1e30 | 2021-01-26 15:53:11 -0800 | [diff] [blame] | 197 | message MemoryDump { |
| 198 | string register_name = 1; |
| 199 | string mapping_name = 2; |
| 200 | uint64 begin_address = 3; |
| 201 | bytes memory = 4; |
Mitch Phillips | 5ddcea2 | 2021-04-19 09:59:17 -0700 | [diff] [blame] | 202 | oneof metadata { |
| 203 | ArmMTEMetadata arm_mte_metadata = 6; |
| 204 | } |
Josh Gao | fc4fb21 | 2021-02-10 16:59:50 -0800 | [diff] [blame] | 205 | |
Mitch Phillips | 5ddcea2 | 2021-04-19 09:59:17 -0700 | [diff] [blame] | 206 | reserved 5, 7 to 999; |
Josh Gao | 76e1e30 | 2021-01-26 15:53:11 -0800 | [diff] [blame] | 207 | } |
| 208 | |
| 209 | message MemoryMapping { |
| 210 | uint64 begin_address = 1; |
| 211 | uint64 end_address = 2; |
| 212 | uint64 offset = 3; |
| 213 | |
| 214 | bool read = 4; |
| 215 | bool write = 5; |
| 216 | bool execute = 6; |
| 217 | |
| 218 | string mapping_name = 7; |
| 219 | string build_id = 8; |
| 220 | uint64 load_bias = 9; |
Josh Gao | fc4fb21 | 2021-02-10 16:59:50 -0800 | [diff] [blame] | 221 | |
| 222 | reserved 10 to 999; |
Josh Gao | 76e1e30 | 2021-01-26 15:53:11 -0800 | [diff] [blame] | 223 | } |
| 224 | |
| 225 | message FD { |
| 226 | int32 fd = 1; |
| 227 | string path = 2; |
| 228 | string owner = 3; |
| 229 | uint64 tag = 4; |
Josh Gao | fc4fb21 | 2021-02-10 16:59:50 -0800 | [diff] [blame] | 230 | |
| 231 | reserved 5 to 999; |
Josh Gao | 76e1e30 | 2021-01-26 15:53:11 -0800 | [diff] [blame] | 232 | } |
| 233 | |
| 234 | message LogBuffer { |
| 235 | string name = 1; |
| 236 | repeated LogMessage logs = 2; |
Josh Gao | fc4fb21 | 2021-02-10 16:59:50 -0800 | [diff] [blame] | 237 | |
| 238 | reserved 3 to 999; |
Josh Gao | 76e1e30 | 2021-01-26 15:53:11 -0800 | [diff] [blame] | 239 | } |
| 240 | |
| 241 | message LogMessage { |
| 242 | string timestamp = 1; |
| 243 | uint32 pid = 2; |
| 244 | uint32 tid = 3; |
| 245 | uint32 priority = 4; |
| 246 | string tag = 5; |
| 247 | string message = 6; |
Josh Gao | fc4fb21 | 2021-02-10 16:59:50 -0800 | [diff] [blame] | 248 | |
| 249 | reserved 7 to 999; |
Josh Gao | 76e1e30 | 2021-01-26 15:53:11 -0800 | [diff] [blame] | 250 | } |