Commit b636e37
committed
[lldb][debugserver] Synchronize interrupt and resume signals (llvm#131073)
This PR fixes a race condition in debugserver where the main thread
calls MachProcess::Interrupt, setting `m_sent_interrupt_signo` while the
exception monitoring thread is checking the value of the variable.
I was on the fence between introducing a new mutex and reusing the
existing exception mutex. With the notable exception of
MachProcess::Interrupt, all the other places where we were already
locking this mutex before accessing the variable. I renamed the mutex to
make it clear that it's now protecting more than the exception messages.
Jason, while investigating a real issue, had a suspicion there was race
condition related to interrupts and I was able to narrow it down by
building debugserver with TSan.
(cherry picked from commit e823449)1 parent c34071e commit b636e37
File tree
2 files changed
+14
-10
lines changed- lldb/tools/debugserver/source/MacOSX
2 files changed
+14
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
427 | 427 | | |
428 | 428 | | |
429 | 429 | | |
430 | | - | |
| 430 | + | |
431 | 431 | | |
432 | 432 | | |
433 | 433 | | |
434 | 434 | | |
435 | 435 | | |
436 | 436 | | |
437 | 437 | | |
438 | | - | |
439 | | - | |
| 438 | + | |
| 439 | + | |
440 | 440 | | |
441 | 441 | | |
442 | 442 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
528 | 528 | | |
529 | 529 | | |
530 | 530 | | |
531 | | - | |
| 531 | + | |
532 | 532 | | |
533 | 533 | | |
534 | 534 | | |
| |||
1338 | 1338 | | |
1339 | 1339 | | |
1340 | 1340 | | |
1341 | | - | |
| 1341 | + | |
1342 | 1342 | | |
| 1343 | + | |
| 1344 | + | |
| 1345 | + | |
1343 | 1346 | | |
1344 | 1347 | | |
1345 | 1348 | | |
| |||
1575 | 1578 | | |
1576 | 1579 | | |
1577 | 1580 | | |
| 1581 | + | |
1578 | 1582 | | |
1579 | 1583 | | |
1580 | 1584 | | |
| |||
1728 | 1732 | | |
1729 | 1733 | | |
1730 | 1734 | | |
1731 | | - | |
| 1735 | + | |
1732 | 1736 | | |
1733 | 1737 | | |
1734 | 1738 | | |
| |||
1854 | 1858 | | |
1855 | 1859 | | |
1856 | 1860 | | |
1857 | | - | |
| 1861 | + | |
1858 | 1862 | | |
1859 | 1863 | | |
1860 | 1864 | | |
| |||
1888 | 1892 | | |
1889 | 1893 | | |
1890 | 1894 | | |
1891 | | - | |
| 1895 | + | |
1892 | 1896 | | |
1893 | 1897 | | |
1894 | 1898 | | |
| |||
2290 | 2294 | | |
2291 | 2295 | | |
2292 | 2296 | | |
2293 | | - | |
| 2297 | + | |
2294 | 2298 | | |
2295 | 2299 | | |
2296 | 2300 | | |
| |||
2304 | 2308 | | |
2305 | 2309 | | |
2306 | 2310 | | |
2307 | | - | |
| 2311 | + | |
2308 | 2312 | | |
2309 | 2313 | | |
2310 | 2314 | | |
| |||
0 commit comments