Commit f7324fa
signals: Fix races that prevent a SIGCONT from aborting a SIGSTOP
The target tg's leader's goroutine can set `groupStopDequeued` with the signals
lock held and then give up the lock to the SIGCONT-sending goroutine, which in
turn will return early from endGroupStopLocked() because a stop has not begun
yet. So we fix this bug by having endGroupStopLocked() always clear
`groupStopDequeued`. In other words, this fixes a race between:
- deliverSingal() -> initiateGroupStop() and
- applySignalSideEffectsLocked() -> endGroupStopLocked()
Now there's a second bug. It is a race between:
- runInterrupt.execute()
- applySignalSideEffectsLocked() -> endGroupStopLocked()
It occurs this way: in runInterrupt(), between participateGroupStopLocked()
and beginInternalStopLocked(), the signal mutex is dropped, allowing a SIGCONT
issuing thread to run its endGroupStopLocked() in the interim, which as it
turns out fails to abort the stop, for runInterrupt.execute() will not consult
`groupStopPending` again when it resumes. We fix this by not dropping the
signals mutex in runInterrupt().
PiperOrigin-RevId: 8852885441 parent 8baf482 commit f7324fa
File tree
3 files changed
+75
-10
lines changed- pkg/sentry/kernel
- test/syscalls/linux
3 files changed
+75
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
812 | 812 | | |
813 | 813 | | |
814 | 814 | | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
815 | 818 | | |
816 | 819 | | |
817 | 820 | | |
| |||
850 | 853 | | |
851 | 854 | | |
852 | 855 | | |
853 | | - | |
854 | | - | |
855 | | - | |
856 | 856 | | |
857 | 857 | | |
858 | 858 | | |
| |||
986 | 986 | | |
987 | 987 | | |
988 | 988 | | |
989 | | - | |
990 | | - | |
991 | 989 | | |
992 | | - | |
993 | | - | |
994 | | - | |
995 | | - | |
996 | 990 | | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
997 | 997 | | |
998 | 998 | | |
999 | 999 | | |
| |||
1026 | 1026 | | |
1027 | 1027 | | |
1028 | 1028 | | |
1029 | | - | |
1030 | 1029 | | |
1031 | 1030 | | |
1032 | 1031 | | |
| 1032 | + | |
1033 | 1033 | | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
1034 | 1038 | | |
1035 | 1039 | | |
1036 | 1040 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2628 | 2628 | | |
2629 | 2629 | | |
2630 | 2630 | | |
| 2631 | + | |
2631 | 2632 | | |
2632 | 2633 | | |
2633 | 2634 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
20 | 25 | | |
21 | 26 | | |
22 | 27 | | |
23 | 28 | | |
24 | 29 | | |
25 | 30 | | |
| 31 | + | |
26 | 32 | | |
27 | 33 | | |
28 | 34 | | |
| |||
130 | 136 | | |
131 | 137 | | |
132 | 138 | | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
133 | 193 | | |
134 | 194 | | |
135 | 195 | | |
| |||
0 commit comments