Commit 02912ca
committed
libdrgn: fix handling of p_filesz < p_memsz in core dumps
I implemented the case of a segment in a core file with p_filesz <
p_memsz by treating the difference as zero bytes. This is correct for
ET_EXEC and ET_DYN, but for ET_CORE, it actually means that the memory
existed in the program but was not saved. For userspace core dumps, this
typically happens for read-only file mappings. For kernel core dumps,
makedumpfile does this to indicate memory that was excluded.
Instead, let's return a DRGN_FAULT_ERROR if an attempt is made to read
from these bytes. In the future, we need to read from the
executable/library files when we can.
Signed-off-by: Omar Sandoval <[email protected]>1 parent 844d828 commit 02912ca
File tree
5 files changed
+40
-20
lines changed- libdrgn
- tests
5 files changed
+40
-20
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1183 | 1183 | | |
1184 | 1184 | | |
1185 | 1185 | | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
1186 | 1192 | | |
1187 | 1193 | | |
1188 | 1194 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
249 | 249 | | |
250 | 250 | | |
251 | 251 | | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | 252 | | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
262 | 259 | | |
263 | | - | |
264 | | - | |
265 | 260 | | |
266 | | - | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
267 | 265 | | |
268 | 266 | | |
269 | 267 | | |
| |||
278 | 276 | | |
279 | 277 | | |
280 | 278 | | |
281 | | - | |
| 279 | + | |
| 280 | + | |
282 | 281 | | |
283 | 282 | | |
284 | | - | |
285 | 283 | | |
286 | 284 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
126 | | - | |
127 | | - | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
128 | 129 | | |
129 | 130 | | |
130 | 131 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
350 | 350 | | |
351 | 351 | | |
352 | 352 | | |
353 | | - | |
354 | | - | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
355 | 357 | | |
356 | 358 | | |
357 | 359 | | |
| |||
381 | 383 | | |
382 | 384 | | |
383 | 385 | | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
384 | 393 | | |
385 | 394 | | |
386 | 395 | | |
| |||
391 | 400 | | |
392 | 401 | | |
393 | 402 | | |
| 403 | + | |
| 404 | + | |
394 | 405 | | |
395 | 406 | | |
396 | 407 | | |
| |||
436 | 447 | | |
437 | 448 | | |
438 | 449 | | |
| 450 | + | |
| 451 | + | |
439 | 452 | | |
440 | 453 | | |
441 | 454 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
806 | 806 | | |
807 | 807 | | |
808 | 808 | | |
809 | | - | |
| 809 | + | |
810 | 810 | | |
811 | 811 | | |
812 | 812 | | |
| |||
825 | 825 | | |
826 | 826 | | |
827 | 827 | | |
828 | | - | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
0 commit comments