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 10syntax = "proto3"; 11 12option java_package = "com.android.server.os"; 13option java_outer_classname = "TombstoneProtos"; 14 15// NOTE TO OEMS: 16// If you add custom fields to this proto, do not use numbers in the reserved range. 17 18// NOTE TO CONSUMERS: 19// With proto3 -- unlike proto2 -- HasValue is unreliable for any field 20// where the default value for that type is also a valid value for the field. 21// This means, for example, that a boolean that is false or an integer that 22// is zero will appear to be missing --- but because they're not actually 23// marked as `optional` in this schema, consumers should just use values 24// without first checking whether or not they're "present". 25// https://protobuf.dev/programming-guides/proto3/#default 26 27message CrashDetail { 28 bytes name = 1; 29 bytes data = 2; 30 31 reserved 3 to 999; 32} 33 34message StackHistoryBufferEntry { 35 BacktraceFrame addr = 1; 36 uint64 fp = 2; 37 uint64 tag = 3; 38 39 reserved 4 to 999; 40} 41 42message StackHistoryBuffer { 43 uint64 tid = 1; 44 repeated StackHistoryBufferEntry entries = 2; 45 46 reserved 3 to 999; 47} 48 49message Tombstone { 50 Architecture arch = 1; 51 Architecture guest_arch = 24; 52 string build_fingerprint = 2; 53 string revision = 3; 54 string timestamp = 4; 55 56 uint32 pid = 5; 57 uint32 tid = 6; 58 uint32 uid = 7; 59 string selinux_label = 8; 60 61 repeated string command_line = 9; 62 63 // Process uptime in seconds. 64 uint32 process_uptime = 20; 65 66 Signal signal_info = 10; 67 string abort_message = 14; 68 repeated CrashDetail crash_details = 21; 69 repeated Cause causes = 15; 70 71 map<uint32, Thread> threads = 16; 72 map<uint32, Thread> guest_threads = 25; 73 repeated MemoryMapping memory_mappings = 17; 74 repeated LogBuffer log_buffers = 18; 75 repeated FD open_fds = 19; 76 77 uint32 page_size = 22; 78 bool has_been_16kb_mode = 23; 79 80 StackHistoryBuffer stack_history_buffer = 26; 81 82 reserved 27 to 999; 83} 84 85enum Architecture { 86 ARM32 = 0; 87 ARM64 = 1; 88 X86 = 2; 89 X86_64 = 3; 90 RISCV64 = 4; 91 NONE = 5; 92 93 reserved 6 to 999; 94} 95 96message Signal { 97 int32 number = 1; 98 string name = 2; 99 100 int32 code = 3; 101 string code_name = 4; 102 103 bool has_sender = 5; 104 int32 sender_uid = 6; 105 int32 sender_pid = 7; 106 107 bool has_fault_address = 8; 108 uint64 fault_address = 9; 109 // Note, may or may not contain the dump of the actual memory contents. Currently, on arm64, we 110 // only include metadata, and not the contents. 111 MemoryDump fault_adjacent_metadata = 10; 112 113 reserved 11 to 999; 114} 115 116message HeapObject { 117 uint64 address = 1; 118 uint64 size = 2; 119 120 uint64 allocation_tid = 3; 121 repeated BacktraceFrame allocation_backtrace = 4; 122 123 uint64 deallocation_tid = 5; 124 repeated BacktraceFrame deallocation_backtrace = 6; 125} 126 127message MemoryError { 128 enum Tool { 129 GWP_ASAN = 0; 130 SCUDO = 1; 131 132 reserved 2 to 999; 133 } 134 Tool tool = 1; 135 136 enum Type { 137 UNKNOWN = 0; 138 USE_AFTER_FREE = 1; 139 DOUBLE_FREE = 2; 140 INVALID_FREE = 3; 141 BUFFER_OVERFLOW = 4; 142 BUFFER_UNDERFLOW = 5; 143 144 reserved 6 to 999; 145 } 146 Type type = 2; 147 148 oneof location { 149 HeapObject heap = 3; 150 } 151 152 reserved 4 to 999; 153} 154 155message Cause { 156 string human_readable = 1; 157 oneof details { 158 MemoryError memory_error = 2; 159 } 160 161 reserved 3 to 999; 162} 163 164message Register { 165 string name = 1; 166 uint64 u64 = 2; 167 168 reserved 3 to 999; 169} 170 171message Thread { 172 int32 id = 1; 173 string name = 2; 174 repeated Register registers = 3; 175 repeated string backtrace_note = 7; 176 repeated string unreadable_elf_files = 9; 177 repeated BacktraceFrame current_backtrace = 4; 178 repeated MemoryDump memory_dump = 5; 179 int64 tagged_addr_ctrl = 6; 180 int64 pac_enabled_keys = 8; 181 182 reserved 10 to 999; 183} 184 185message BacktraceFrame { 186 uint64 rel_pc = 1; 187 uint64 pc = 2; 188 uint64 sp = 3; 189 190 string function_name = 4; 191 uint64 function_offset = 5; 192 193 string file_name = 6; 194 uint64 file_map_offset = 7; 195 string build_id = 8; 196 197 reserved 9 to 999; 198} 199 200message ArmMTEMetadata { 201 // One memory tag per granule (e.g. every 16 bytes) of regular memory. 202 bytes memory_tags = 1; 203 reserved 2 to 999; 204} 205 206message MemoryDump { 207 string register_name = 1; 208 string mapping_name = 2; 209 uint64 begin_address = 3; 210 bytes memory = 4; 211 oneof metadata { 212 ArmMTEMetadata arm_mte_metadata = 6; 213 } 214 215 reserved 5, 7 to 999; 216} 217 218message MemoryMapping { 219 uint64 begin_address = 1; 220 uint64 end_address = 2; 221 uint64 offset = 3; 222 223 bool read = 4; 224 bool write = 5; 225 bool execute = 6; 226 227 string mapping_name = 7; 228 string build_id = 8; 229 uint64 load_bias = 9; 230 231 reserved 10 to 999; 232} 233 234message FD { 235 int32 fd = 1; 236 string path = 2; 237 string owner = 3; 238 uint64 tag = 4; 239 240 reserved 5 to 999; 241} 242 243message LogBuffer { 244 string name = 1; 245 repeated LogMessage logs = 2; 246 247 reserved 3 to 999; 248} 249 250message LogMessage { 251 string timestamp = 1; 252 uint32 pid = 2; 253 uint32 tid = 3; 254 uint32 priority = 4; 255 string tag = 5; 256 string message = 6; 257 258 reserved 7 to 999; 259} 260