Commit 15860bb
authored
feat(crashtracking)!: emit ucontext registers as structured data (#1787)
# What does this PR do?
This PR extracts out register data from `ucontext` and emits ucontext as structured data. The reason we do this is because ucontext register and pointer values are needed as structured data for downstream diagnosis workflows.
We also promote ucontext from an experimental field to a field in the top level report
# Motivation
[RFC: Crashtracker Crash Pre-Diagnosis](https://docs.google.com/document/d/18ufgwT1WK6YKCpz_N_u59MLMyRB-ot-7vbuOJ77xPK0/edit?usp=sharing)
# Additional Notes
Schema
```
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"title": "UContext Schema",
"description": "JSON schema for crashtracker ucontext data",
"required": ["arch", "registers", "raw"],
"properties": {
"arch": {
"type": "string",
"enum": ["x86_64", "aarch64"],
"description": "Target architecture"
},
"registers": {
"type": "object",
"description": "CPU register values as key-value pairs with hex string values",
"additionalProperties": {
"type": "string",
"pattern": "^0x[0-9a-f]+$"
}
},
"raw": {
"type": "string",
"description": "Debug representation of the complete ucontext structure"
}
},
"additionalProperties": false
}
```
Example payload
```
{
"arch": "x86_64",
"registers": {
"rax": "0x00007ffceae07410",
"rdx": "0x00007ffceae07418",
"r8": "0x000055fcfd2ec010",
"r11": "0x346a1a95dc671c71",
"rsp": "0x00007ffceae033f8",
"rdi": "0x00000000000003fc",
"rbx": "0x00000000000003fc",
"r12": "0x000055fcce53ad28",
"r10": "0x000055fcfd2ecf80",
"r13": "0x000000000000001a",
"rip": "0x000055fcce4d7d90",
"rsi": "0x00000000000003fb",
"rbp": "0x0000000000000001",
"r9": "0x0000000000000007",
"rcx": "0x0000000000000000",
"r14": "0x00007ffceae07418",
"r15": "0x0000000000000000"
},
"raw": "ucontext_t { uc_flags: 7, uc_link: 0x0, uc_stack: stack_t { ss_sp: 0x7f70abd74000, ss_flags: 0, ss_size: 65536 }, uc_mcontext: mcontext_t { gregs: [94545067819024, 7, 94545067822976, 3776860468453776497, 94544281709864, 26, 140724249064472, 0, 1020, 1019, 1, 1020, 140724249064472, 140724249064464, 0, 140724249048056, 94544281304464, 66050, 12103423998558259, 6, 14, 0, 140724249048056], fpregs: 0x7f70abd83c80, __private: [0, 0, 0, 0, 0, 0, 0, 0] }, uc_sigmask: sigset_t { __val: [0, 11, 1, 140724249048056, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] }, __private: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 127, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 31, 0, 0, 255, 255, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 240, 238, 223, 235, 252, 127, 0, 0, 104, 167, 83, 206, 252, 85, 0, 0, 192, 58, 192, 171, 112, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 112, 123, 47, 253, 252, 85, 0, 0, 160, 123, 47, 253, 252, 85, 0, 0, 222, 196, 170, 171, 112, 127, 0, 0, 48, 239, 223, 235, 252, 127, 0, 0, 97, 5, 177, 171, 112, 127, 0, 0, 48, 241, 223, 235, 252, 127, 0, 0, 32, 0, 0, 96, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 21, 227, 170, 171, 112, 127, 0, 0, 104, 167, 83, 206, 252, 85, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 240, 105, 47, 253, 252, 85, 0, 0, 255, 0, 0, 255, 0, 0, 255, 255, 255, 0, 255, 0, 255, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 0, 0, 0, 255, 0, 0, 0, 0, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 83, 88, 80, 70, 68, 3, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 64, 3, 0, 0, 0, 0, 0, 0], __ssp: [0, 0, 0, 3] }"
}
```
# How to test the change?
Unit test
Co-authored-by: gyuheon.oh <[email protected]>1 parent 29678bd commit 15860bb
10 files changed
Lines changed: 451 additions & 46 deletions
File tree
- docs/RFCs
- artifacts
- libdd-crashtracker/src
- collector
- crash_info
- receiver
Lines changed: 31 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
| 42 | + | |
41 | 43 | | |
42 | 44 | | |
43 | 45 | | |
44 | 46 | | |
45 | 47 | | |
46 | 48 | | |
47 | 49 | | |
48 | | - | |
| 50 | + | |
49 | 51 | | |
50 | 52 | | |
51 | 53 | | |
| |||
132 | 134 | | |
133 | 135 | | |
134 | 136 | | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
135 | 148 | | |
136 | 149 | | |
137 | 150 | | |
| |||
276 | 289 | | |
277 | 290 | | |
278 | 291 | | |
279 | | - | |
| 292 | + | |
280 | 293 | | |
281 | 294 | | |
282 | 295 | | |
283 | 296 | | |
284 | 297 | | |
285 | 298 | | |
286 | 299 | | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
287 | 309 | | |
288 | 310 | | |
289 | 311 | | |
290 | 312 | | |
291 | | - | |
| 313 | + | |
292 | 314 | | |
293 | 315 | | |
294 | 316 | | |
295 | | - | |
| 317 | + | |
296 | 318 | | |
297 | 319 | | |
298 | 320 | | |
299 | 321 | | |
300 | 322 | | |
301 | 323 | | |
302 | 324 | | |
| 325 | + | |
Lines changed: 52 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
103 | 113 | | |
104 | 114 | | |
105 | 115 | | |
| |||
141 | 151 | | |
142 | 152 | | |
143 | 153 | | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
144 | 160 | | |
145 | 161 | | |
146 | 162 | | |
| |||
175 | 191 | | |
176 | 192 | | |
177 | 193 | | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | 194 | | |
185 | 195 | | |
186 | 196 | | |
| |||
251 | 261 | | |
252 | 262 | | |
253 | 263 | | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
254 | 272 | | |
255 | 273 | | |
256 | 274 | | |
| |||
564 | 582 | | |
565 | 583 | | |
566 | 584 | | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
567 | 613 | | |
568 | 614 | | |
569 | 615 | | |
0 commit comments