Commit 7ce043c
Avoid use-after-free with stdexec::run_loop (#1746)
* Avoid use-after-free with stdexec::run_loop
We need to synchronize returning from `__run_loop_base::run` with
potentially concurrent calls to `__run_loop_base::finish`. This is done
by introducing a counter, ensuring proper completion of all tasks in
flight.
Also see #1742 for additional
information.
* Fixing use after free
- Properly synchronizing `finish` with `run` with task counts
- Adding sync_wait relacy test for verification
- adapting atomic wrappers to account for missing std::atomic_ref in relacy
* Apply suggestions from code review
---------
Co-authored-by: Eric Niebler <[email protected]>1 parent 970dbac commit 7ce043c
File tree
4 files changed
+78
-7
lines changed- include/stdexec/__detail
- test/rrd
4 files changed
+78
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
| 61 | + | |
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
29 | 31 | | |
30 | 32 | | |
31 | 33 | | |
| |||
34 | 36 | | |
35 | 37 | | |
36 | 38 | | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
37 | 43 | | |
38 | 44 | | |
39 | 45 | | |
40 | 46 | | |
41 | 47 | | |
42 | 48 | | |
43 | 49 | | |
44 | | - | |
45 | | - | |
| 50 | + | |
| 51 | + | |
46 | 52 | | |
47 | 53 | | |
48 | 54 | | |
49 | 55 | | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
50 | 61 | | |
51 | 62 | | |
52 | | - | |
| 63 | + | |
| 64 | + | |
53 | 65 | | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
54 | 70 | | |
| 71 | + | |
| 72 | + | |
55 | 73 | | |
56 | 74 | | |
57 | 75 | | |
| |||
73 | 91 | | |
74 | 92 | | |
75 | 93 | | |
| 94 | + | |
76 | 95 | | |
77 | 96 | | |
78 | 97 | | |
| |||
89 | 108 | | |
90 | 109 | | |
91 | 110 | | |
| 111 | + | |
92 | 112 | | |
93 | 113 | | |
94 | 114 | | |
| 115 | + | |
95 | 116 | | |
96 | 117 | | |
97 | 118 | | |
98 | 119 | | |
99 | 120 | | |
| 121 | + | |
100 | 122 | | |
101 | 123 | | |
102 | 124 | | |
| |||
112 | 134 | | |
113 | 135 | | |
114 | 136 | | |
| 137 | + | |
| 138 | + | |
115 | 139 | | |
116 | 140 | | |
117 | 141 | | |
118 | 142 | | |
119 | 143 | | |
| 144 | + | |
120 | 145 | | |
121 | 146 | | |
122 | 147 | | |
| 148 | + | |
123 | 149 | | |
124 | 150 | | |
125 | 151 | | |
126 | 152 | | |
127 | 153 | | |
128 | 154 | | |
| 155 | + | |
129 | 156 | | |
130 | 157 | | |
131 | 158 | | |
| |||
186 | 213 | | |
187 | 214 | | |
188 | 215 | | |
189 | | - | |
| 216 | + | |
190 | 217 | | |
191 | 218 | | |
192 | 219 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
0 commit comments