Commit 508bb6e
committed
erts: Fix race between setup_bif_timer and suspending process
Symptom: SEGV seen one time in process_SUITE:suspend_process_pausing_bif_timer_mass
Scenario:
A1. Process A calls setup_bif_timer()
A2. Create BIF timer
A2. Lock ERTS_PROC_LOCK_BTM for receiving process B (proc)
A3. Read proc->paused_bif_timers to be NULL
A4. Insert timer into proc->bif_timers tree
A5. Unlock ERTS_PROC_LOCK_BTM for B
B6. Suspending process B calls erts_pause_bif_timers()
B7. Lock ERTS_PROC_LOCK_BTM
B8. Set c_p->paused_bif_timers
B9. Cancel timer in c_p->bif_timers and free message buffer
A10. Process A continues in setup_bif_timer()
A11. Read proc->paused_bif_timers AGAIN, now set as != NULL
A12. Cancel timer and crash on double free of message buffer
Fix: Don't read proc->paused_bif_timers again without lock1 parent 044244c commit 508bb6e
1 file changed
Lines changed: 9 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1834 | 1834 | | |
1835 | 1835 | | |
1836 | 1836 | | |
1837 | | - | |
| 1837 | + | |
| 1838 | + | |
1838 | 1839 | | |
1839 | | - | |
1840 | | - | |
1841 | | - | |
1842 | | - | |
1843 | | - | |
| 1840 | + | |
1844 | 1841 | | |
1845 | 1842 | | |
1846 | | - | |
| 1843 | + | |
| 1844 | + | |
| 1845 | + | |
| 1846 | + | |
| 1847 | + | |
| 1848 | + | |
1847 | 1849 | | |
1848 | 1850 | | |
1849 | 1851 | | |
| |||
1855 | 1857 | | |
1856 | 1858 | | |
1857 | 1859 | | |
1858 | | - | |
1859 | | - | |
1860 | | - | |
1861 | 1860 | | |
1862 | 1861 | | |
1863 | 1862 | | |
| |||
0 commit comments