forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit62ec3e1
Fix possible double-release of spinlock in procsignal.c
9d9b9d4 has added spinlocks to protect the fields in ProcSignalflags, introducing a code path in ProcSignalInit() where a spinlockcould be released twice if the pss_pid field of a ProcSignalSlot isfound as already set. Multiple spinlock releases have no effect withmost spinlock implementations, but this could cause the code to run intoissues when the spinlock is acquired concurrently by a differentprocess.This sanity check on pss_pid generates a LOG that can be delayed untilafter the spinlock is released as, like older versions up to v17, thecode expects the initialization of the ProcSignalSlot to happen even ifpss_pid is found incorrect. The code is changed so as the old pss_pidis read while holding the slot's spinlock, with the LOG from the sanitycheck generated after releasing the spinlock, preventing the doublerelease.Author: Maksim Melnikov <m.melnikov@postgrespro.ru>Co-authored-by: Maxim Orlov <orlovmg@gmail.com>Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>Discussion:https://postgr.es/m/dca47527-2d8b-4e3b-b5a0-e2deb73371a4@postgrespro.ru1 parent15df9d7 commit62ec3e1
1 file changed
+9
-7
lines changedLines changed: 9 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
167 | 167 |
| |
168 | 168 |
| |
169 | 169 |
| |
| 170 | + | |
170 | 171 |
| |
171 | 172 |
| |
172 | 173 |
| |
173 | 174 |
| |
174 | 175 |
| |
175 | 176 |
| |
176 | 177 |
| |
177 |
| - | |
178 | 178 |
| |
179 |
| - | |
180 |
| - | |
181 |
| - | |
182 |
| - | |
183 |
| - | |
184 |
| - | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
185 | 182 |
| |
186 | 183 |
| |
187 | 184 |
| |
| |||
208 | 205 |
| |
209 | 206 |
| |
210 | 207 |
| |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
211 | 213 |
| |
212 | 214 |
| |
213 | 215 |
| |
|
0 commit comments
Comments
(0)