Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0393f54

Browse files
committed
Fix double-release of spinlock
Commit9d9b9d4 added spinlocks to protect the fields in ProcSignalflags, but in EmitProcSignalBarrier(), the spinlock was releasedtwice. With most spinlock implementations, releasing a lock that's notheld is not easy to notice, because most of the time it does nothing,but if the spinlock was concurrently acquired by another process, itcould lead to more serious issues. Fortunately, with the--disable-spinlocks emulation implementation, it caused more visiblefailures.In the passing, fix a type in comment and add an assertion that theprocNumber passed to SendProcSignal looks valid.Discussion:https://www.postgresql.org/message-id/b8ce284c-18a2-4a79-afd3-1991a2e7d246@iki.fi
1 parent8bda213 commit0393f54

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

‎src/backend/storage/ipc/procsignal.c‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ SendProcSignal(pid_t pid, ProcSignalReason reason, ProcNumber procNumber)
284284

285285
if (procNumber!=INVALID_PROC_NUMBER)
286286
{
287+
Assert(procNumber<NumProcSignalSlots);
287288
slot=&ProcSignal->psh_slot[procNumber];
288289

289290
SpinLockAcquire(&slot->pss_mutex);
@@ -300,7 +301,7 @@ SendProcSignal(pid_t pid, ProcSignalReason reason, ProcNumber procNumber)
300301
else
301302
{
302303
/*
303-
*Pronumber not provided, so search the array using pid. We search
304+
*procNumber not provided, so search the array using pid. We search
304305
* the array back to front so as to reduce search overhead. Passing
305306
* INVALID_PROC_NUMBER means that the target is most likely an
306307
* auxiliary process, which will have a slot near the end of the
@@ -404,7 +405,8 @@ EmitProcSignalBarrier(ProcSignalBarrierType type)
404405
SpinLockRelease(&slot->pss_mutex);
405406
kill(pid,SIGUSR1);
406407
}
407-
SpinLockRelease(&slot->pss_mutex);
408+
else
409+
SpinLockRelease(&slot->pss_mutex);
408410
}
409411
}
410412

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp