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 | |
Josh Gao | 76e1e30 | 2021-01-26 15:53:11 -0800 | [diff] [blame] | 18 | message Tombstone { |
| 19 | Architecture arch = 1; |
| 20 | string build_fingerprint = 2; |
| 21 | string revision = 3; |
| 22 | string timestamp = 4; |
| 23 | |
| 24 | uint32 pid = 5; |
| 25 | uint32 tid = 6; |
| 26 | uint32 uid = 7; |
| 27 | string selinux_label = 8; |
| 28 | |
Josh Gao | 31348a7 | 2021-03-29 21:53:42 -0700 | [diff] [blame] | 29 | repeated string command_line = 9; |
Josh Gao | 76e1e30 | 2021-01-26 15:53:11 -0800 | [diff] [blame] | 30 | |
Josh Gao | dbb83de | 2021-03-01 23:13:13 -0800 | [diff] [blame] | 31 | // Process uptime in seconds. |
| 32 | uint32 process_uptime = 20; |
| 33 | |
Josh Gao | 76e1e30 | 2021-01-26 15:53:11 -0800 | [diff] [blame] | 34 | Signal signal_info = 10; |
| 35 | string abort_message = 14; |
Peter Collingbourne | 1a1f7d7 | 2021-03-08 16:53:54 -0800 | [diff] [blame] | 36 | repeated Cause causes = 15; |
Josh Gao | 76e1e30 | 2021-01-26 15:53:11 -0800 | [diff] [blame] | 37 | |
| 38 | map<uint32, Thread> threads = 16; |
| 39 | repeated MemoryMapping memory_mappings = 17; |
| 40 | repeated LogBuffer log_buffers = 18; |
| 41 | repeated FD open_fds = 19; |
Josh Gao | fc4fb21 | 2021-02-10 16:59:50 -0800 | [diff] [blame] | 42 | |
Josh Gao | dbb83de | 2021-03-01 23:13:13 -0800 | [diff] [blame] | 43 | reserved 21 to 999; |
Josh Gao | 76e1e30 | 2021-01-26 15:53:11 -0800 | [diff] [blame] | 44 | } |
| 45 | |
| 46 | enum Architecture { |
| 47 | ARM32 = 0; |
| 48 | ARM64 = 1; |
| 49 | X86 = 2; |
| 50 | X86_64 = 3; |
Josh Gao | fc4fb21 | 2021-02-10 16:59:50 -0800 | [diff] [blame] | 51 | |
| 52 | reserved 4 to 999; |
Josh Gao | 76e1e30 | 2021-01-26 15:53:11 -0800 | [diff] [blame] | 53 | } |
| 54 | |
| 55 | message Signal { |
| 56 | int32 number = 1; |
| 57 | string name = 2; |
| 58 | |
| 59 | int32 code = 3; |
| 60 | string code_name = 4; |
| 61 | |
| 62 | bool has_sender = 5; |
| 63 | int32 sender_uid = 6; |
| 64 | int32 sender_pid = 7; |
| 65 | |
| 66 | bool has_fault_address = 8; |
| 67 | uint64 fault_address = 9; |
Mitch Phillips | 5ddcea2 | 2021-04-19 09:59:17 -0700 | [diff] [blame] | 68 | // Note, may or may not contain the dump of the actual memory contents. Currently, on arm64, we |
| 69 | // only include metadata, and not the contents. |
| 70 | MemoryDump fault_adjacent_metadata = 10; |
Josh Gao | fc4fb21 | 2021-02-10 16:59:50 -0800 | [diff] [blame] | 71 | |
Mitch Phillips | 5ddcea2 | 2021-04-19 09:59:17 -0700 | [diff] [blame] | 72 | reserved 11 to 999; |
Josh Gao | 76e1e30 | 2021-01-26 15:53:11 -0800 | [diff] [blame] | 73 | } |
| 74 | |
Peter Collingbourne | 1a1f7d7 | 2021-03-08 16:53:54 -0800 | [diff] [blame] | 75 | message HeapObject { |
| 76 | uint64 address = 1; |
| 77 | uint64 size = 2; |
| 78 | |
| 79 | uint64 allocation_tid = 3; |
| 80 | repeated BacktraceFrame allocation_backtrace = 4; |
| 81 | |
| 82 | uint64 deallocation_tid = 5; |
| 83 | repeated BacktraceFrame deallocation_backtrace = 6; |
| 84 | } |
| 85 | |
| 86 | message MemoryError { |
| 87 | enum Tool { |
| 88 | GWP_ASAN = 0; |
| 89 | SCUDO = 1; |
| 90 | |
| 91 | reserved 2 to 999; |
| 92 | } |
| 93 | Tool tool = 1; |
| 94 | |
| 95 | enum Type { |
| 96 | UNKNOWN = 0; |
| 97 | USE_AFTER_FREE = 1; |
| 98 | DOUBLE_FREE = 2; |
| 99 | INVALID_FREE = 3; |
| 100 | BUFFER_OVERFLOW = 4; |
| 101 | BUFFER_UNDERFLOW = 5; |
| 102 | |
| 103 | reserved 6 to 999; |
| 104 | } |
| 105 | Type type = 2; |
| 106 | |
| 107 | oneof location { |
| 108 | HeapObject heap = 3; |
| 109 | } |
| 110 | |
| 111 | reserved 4 to 999; |
| 112 | } |
| 113 | |
Josh Gao | 76e1e30 | 2021-01-26 15:53:11 -0800 | [diff] [blame] | 114 | message Cause { |
| 115 | string human_readable = 1; |
Peter Collingbourne | 1a1f7d7 | 2021-03-08 16:53:54 -0800 | [diff] [blame] | 116 | oneof details { |
| 117 | MemoryError memory_error = 2; |
| 118 | } |
Josh Gao | fc4fb21 | 2021-02-10 16:59:50 -0800 | [diff] [blame] | 119 | |
Peter Collingbourne | 1a1f7d7 | 2021-03-08 16:53:54 -0800 | [diff] [blame] | 120 | reserved 3 to 999; |
Josh Gao | 76e1e30 | 2021-01-26 15:53:11 -0800 | [diff] [blame] | 121 | } |
| 122 | |
| 123 | message Register { |
| 124 | string name = 1; |
| 125 | uint64 u64 = 2; |
Josh Gao | fc4fb21 | 2021-02-10 16:59:50 -0800 | [diff] [blame] | 126 | |
| 127 | reserved 3 to 999; |
Josh Gao | 76e1e30 | 2021-01-26 15:53:11 -0800 | [diff] [blame] | 128 | } |
| 129 | |
| 130 | message Thread { |
| 131 | int32 id = 1; |
| 132 | string name = 2; |
| 133 | repeated Register registers = 3; |
Christopher Ferris | fe751c5 | 2021-04-16 09:40:40 -0700 | [diff] [blame] | 134 | repeated string backtrace_note = 7; |
Christopher Ferris | c95047d | 2022-03-14 15:02:11 -0700 | [diff] [blame] | 135 | repeated string unreadable_elf_files = 9; |
Josh Gao | 76e1e30 | 2021-01-26 15:53:11 -0800 | [diff] [blame] | 136 | repeated BacktraceFrame current_backtrace = 4; |
| 137 | repeated MemoryDump memory_dump = 5; |
Peter Collingbourne | 1a1f7d7 | 2021-03-08 16:53:54 -0800 | [diff] [blame] | 138 | int64 tagged_addr_ctrl = 6; |
Elliott Hughes | d13ea52 | 2022-01-13 09:20:26 -0800 | [diff] [blame] | 139 | int64 pac_enabled_keys = 8; |
Josh Gao | fc4fb21 | 2021-02-10 16:59:50 -0800 | [diff] [blame] | 140 | |
Christopher Ferris | c95047d | 2022-03-14 15:02:11 -0700 | [diff] [blame] | 141 | reserved 10 to 999; |
Josh Gao | 76e1e30 | 2021-01-26 15:53:11 -0800 | [diff] [blame] | 142 | } |
| 143 | |
| 144 | message BacktraceFrame { |
| 145 | uint64 rel_pc = 1; |
| 146 | uint64 pc = 2; |
| 147 | uint64 sp = 3; |
| 148 | |
| 149 | string function_name = 4; |
| 150 | uint64 function_offset = 5; |
| 151 | |
| 152 | string file_name = 6; |
| 153 | uint64 file_map_offset = 7; |
| 154 | string build_id = 8; |
Josh Gao | fc4fb21 | 2021-02-10 16:59:50 -0800 | [diff] [blame] | 155 | |
| 156 | reserved 9 to 999; |
Josh Gao | 76e1e30 | 2021-01-26 15:53:11 -0800 | [diff] [blame] | 157 | } |
| 158 | |
Mitch Phillips | 5ddcea2 | 2021-04-19 09:59:17 -0700 | [diff] [blame] | 159 | message ArmMTEMetadata { |
| 160 | // One memory tag per granule (e.g. every 16 bytes) of regular memory. |
| 161 | bytes memory_tags = 1; |
| 162 | reserved 2 to 999; |
| 163 | } |
| 164 | |
Josh Gao | 76e1e30 | 2021-01-26 15:53:11 -0800 | [diff] [blame] | 165 | message MemoryDump { |
| 166 | string register_name = 1; |
| 167 | string mapping_name = 2; |
| 168 | uint64 begin_address = 3; |
| 169 | bytes memory = 4; |
Mitch Phillips | 5ddcea2 | 2021-04-19 09:59:17 -0700 | [diff] [blame] | 170 | oneof metadata { |
| 171 | ArmMTEMetadata arm_mte_metadata = 6; |
| 172 | } |
Josh Gao | fc4fb21 | 2021-02-10 16:59:50 -0800 | [diff] [blame] | 173 | |
Mitch Phillips | 5ddcea2 | 2021-04-19 09:59:17 -0700 | [diff] [blame] | 174 | reserved 5, 7 to 999; |
Josh Gao | 76e1e30 | 2021-01-26 15:53:11 -0800 | [diff] [blame] | 175 | } |
| 176 | |
| 177 | message MemoryMapping { |
| 178 | uint64 begin_address = 1; |
| 179 | uint64 end_address = 2; |
| 180 | uint64 offset = 3; |
| 181 | |
| 182 | bool read = 4; |
| 183 | bool write = 5; |
| 184 | bool execute = 6; |
| 185 | |
| 186 | string mapping_name = 7; |
| 187 | string build_id = 8; |
| 188 | uint64 load_bias = 9; |
Josh Gao | fc4fb21 | 2021-02-10 16:59:50 -0800 | [diff] [blame] | 189 | |
| 190 | reserved 10 to 999; |
Josh Gao | 76e1e30 | 2021-01-26 15:53:11 -0800 | [diff] [blame] | 191 | } |
| 192 | |
| 193 | message FD { |
| 194 | int32 fd = 1; |
| 195 | string path = 2; |
| 196 | string owner = 3; |
| 197 | uint64 tag = 4; |
Josh Gao | fc4fb21 | 2021-02-10 16:59:50 -0800 | [diff] [blame] | 198 | |
| 199 | reserved 5 to 999; |
Josh Gao | 76e1e30 | 2021-01-26 15:53:11 -0800 | [diff] [blame] | 200 | } |
| 201 | |
| 202 | message LogBuffer { |
| 203 | string name = 1; |
| 204 | repeated LogMessage logs = 2; |
Josh Gao | fc4fb21 | 2021-02-10 16:59:50 -0800 | [diff] [blame] | 205 | |
| 206 | reserved 3 to 999; |
Josh Gao | 76e1e30 | 2021-01-26 15:53:11 -0800 | [diff] [blame] | 207 | } |
| 208 | |
| 209 | message LogMessage { |
| 210 | string timestamp = 1; |
| 211 | uint32 pid = 2; |
| 212 | uint32 tid = 3; |
| 213 | uint32 priority = 4; |
| 214 | string tag = 5; |
| 215 | string message = 6; |
Josh Gao | fc4fb21 | 2021-02-10 16:59:50 -0800 | [diff] [blame] | 216 | |
| 217 | reserved 7 to 999; |
Josh Gao | 76e1e30 | 2021-01-26 15:53:11 -0800 | [diff] [blame] | 218 | } |