Commit 7ed37d8
Fix use-after-unmap in markMovingForSlabRelease
Summary:
I noticed that in coredumper there have been crashes in fookeep for some time which should be fixed with this diff.
Fix a race condition where `toString()` accesses slab memory after
`abortSlabRelease()` has restored the slab to normal operation. Another
thread (e.g. MemoryMonitor) can pick up the same slab, release it, and
call `adviseSlab()` which does `madvise(MADV_REMOVE)`, unmapping the
pages before the first thread reads from them — causing SIGSEGV.
The fix captures the item description before aborting, while the slab is
still marked for release and protected from being picked by other threads.
I didn't test if this actually fixes the issue because I am not sure how to reproduce it. We can check coredumper in a few weeks to see if the issue is really fixed.
Reviewed By: pbhandar2, rlyerly
Differential Revision: D97321920
fbshipit-source-id: 05c2929389393ca5355037e9325f3d6c2f45e3db1 parent 84f0b13 commit 7ed37d8
1 file changed
Lines changed: 27 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5432 | 5432 | | |
5433 | 5433 | | |
5434 | 5434 | | |
| 5435 | + | |
| 5436 | + | |
| 5437 | + | |
| 5438 | + | |
| 5439 | + | |
| 5440 | + | |
| 5441 | + | |
| 5442 | + | |
| 5443 | + | |
| 5444 | + | |
| 5445 | + | |
| 5446 | + | |
| 5447 | + | |
| 5448 | + | |
| 5449 | + | |
| 5450 | + | |
| 5451 | + | |
| 5452 | + | |
| 5453 | + | |
| 5454 | + | |
| 5455 | + | |
| 5456 | + | |
| 5457 | + | |
| 5458 | + | |
| 5459 | + | |
5435 | 5460 | | |
5436 | 5461 | | |
5437 | 5462 | | |
| |||
5449 | 5474 | | |
5450 | 5475 | | |
5451 | 5476 | | |
5452 | | - | |
5453 | | - | |
5454 | | - | |
5455 | | - | |
5456 | | - | |
5457 | | - | |
| 5477 | + | |
5458 | 5478 | | |
5459 | 5479 | | |
5460 | 5480 | | |
5461 | 5481 | | |
5462 | 5482 | | |
5463 | 5483 | | |
5464 | | - | |
5465 | | - | |
5466 | | - | |
5467 | | - | |
5468 | | - | |
5469 | | - | |
5470 | | - | |
| 5484 | + | |
5471 | 5485 | | |
5472 | 5486 | | |
5473 | 5487 | | |
| |||
0 commit comments