1////////////////////////////////////////////////////////////////////////////////
2//
3//  Copied from AOSP:
4//    - system/core/debuggerd/proto/tombstone.proto
5//  at:
6//    - 2021-06-29
7//    - 5ddcea2924f48797cf747f952f6fe2f561dacb24
8//    - https://android-review.googlesource.com/c/platform/system/core/+/1680005
9//
10//  This file is deliberately copied so that older-built apps can guarantee
11//  they are still able to read the tombstone using this definition, even if the
12//  platform proto is updated with new fields.
13//
14////////////////////////////////////////////////////////////////////////////////
15syntax = "proto3";
16option java_package = "android.cts.gwp_asan";
17option java_outer_classname = "Android13Tombstone";
18// NOTE TO OEMS:
19// If you add custom fields to this proto, do not use numbers in the reserved range.
20message Tombstone {
21  Architecture arch = 1;
22  string build_fingerprint = 2;
23  string revision = 3;
24  string timestamp = 4;
25  uint32 pid = 5;
26  uint32 tid = 6;
27  uint32 uid = 7;
28  string selinux_label = 8;
29  repeated string command_line = 9;
30  // Process uptime in seconds.
31  uint32 process_uptime = 20;
32  Signal signal_info = 10;
33  string abort_message = 14;
34  repeated Cause causes = 15;
35  map<uint32, Thread> threads = 16;
36  repeated MemoryMapping memory_mappings = 17;
37  repeated LogBuffer log_buffers = 18;
38  repeated FD open_fds = 19;
39  reserved 21 to 999;
40}
41enum Architecture {
42  ARM32 = 0;
43  ARM64 = 1;
44  X86 = 2;
45  X86_64 = 3;
46  reserved 4 to 999;
47}
48message Signal {
49  int32 number = 1;
50  string name = 2;
51  int32 code = 3;
52  string code_name = 4;
53  bool has_sender = 5;
54  int32 sender_uid = 6;
55  int32 sender_pid = 7;
56  bool has_fault_address = 8;
57  uint64 fault_address = 9;
58  // Note, may or may not contain the dump of the actual memory contents. Currently, on arm64, we
59  // only include metadata, and not the contents.
60  MemoryDump fault_adjacent_metadata = 10;
61  reserved 11 to 999;
62}
63message HeapObject {
64  uint64 address = 1;
65  uint64 size = 2;
66  uint64 allocation_tid = 3;
67  repeated BacktraceFrame allocation_backtrace = 4;
68  uint64 deallocation_tid = 5;
69  repeated BacktraceFrame deallocation_backtrace = 6;
70}
71message MemoryError {
72  enum Tool {
73    GWP_ASAN = 0;
74    SCUDO = 1;
75    reserved 2 to 999;
76  }
77  Tool tool = 1;
78  enum Type {
79    UNKNOWN = 0;
80    USE_AFTER_FREE = 1;
81    DOUBLE_FREE = 2;
82    INVALID_FREE = 3;
83    BUFFER_OVERFLOW = 4;
84    BUFFER_UNDERFLOW = 5;
85    reserved 6 to 999;
86  }
87  Type type = 2;
88  oneof location {
89    HeapObject heap = 3;
90  }
91  reserved 4 to 999;
92}
93message Cause {
94  string human_readable = 1;
95  oneof details {
96    MemoryError memory_error = 2;
97  }
98  reserved 3 to 999;
99}
100message Register {
101  string name = 1;
102  uint64 u64 = 2;
103  reserved 3 to 999;
104}
105message Thread {
106  int32 id = 1;
107  string name = 2;
108  repeated Register registers = 3;
109  repeated string backtrace_note = 7;
110  repeated BacktraceFrame current_backtrace = 4;
111  repeated MemoryDump memory_dump = 5;
112  int64 tagged_addr_ctrl = 6;
113  reserved 8 to 999;
114}
115message BacktraceFrame {
116  uint64 rel_pc = 1;
117  uint64 pc = 2;
118  uint64 sp = 3;
119  string function_name = 4;
120  uint64 function_offset = 5;
121  string file_name = 6;
122  uint64 file_map_offset = 7;
123  string build_id = 8;
124  reserved 9 to 999;
125}
126message ArmMTEMetadata {
127  // One memory tag per granule (e.g. every 16 bytes) of regular memory.
128  bytes memory_tags = 1;
129  reserved 2 to 999;
130}
131message MemoryDump {
132  string register_name = 1;
133  string mapping_name = 2;
134  uint64 begin_address = 3;
135  bytes memory = 4;
136  oneof metadata {
137    ArmMTEMetadata arm_mte_metadata = 6;
138  }
139  reserved 5, 7 to 999;
140}
141message MemoryMapping {
142  uint64 begin_address = 1;
143  uint64 end_address = 2;
144  uint64 offset = 3;
145  bool read = 4;
146  bool write = 5;
147  bool execute = 6;
148  string mapping_name = 7;
149  string build_id = 8;
150  uint64 load_bias = 9;
151  reserved 10 to 999;
152}
153message FD {
154  int32 fd = 1;
155  string path = 2;
156  string owner = 3;
157  uint64 tag = 4;
158  reserved 5 to 999;
159}
160message LogBuffer {
161  string name = 1;
162  repeated LogMessage logs = 2;
163  reserved 3 to 999;
164}
165message LogMessage {
166  string timestamp = 1;
167  uint32 pid = 2;
168  uint32 tid = 3;
169  uint32 priority = 4;
170  string tag = 5;
171  string message = 6;
172  reserved 7 to 999;
173}
174