pgsql: Fix double-release of spinlock

From: Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix double-release of spinlock
Date: 2024-07-29 15:24:52
Message-ID: E1sYSF2-001lEB-D1@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Fix double-release of spinlock

Commit 9d9b9d46f3 added spinlocks to protect the fields in ProcSignal
flags, but in EmitProcSignalBarrier(), the spinlock was released
twice. With most spinlock implementations, releasing a lock that's not
held is not easy to notice, because most of the time it does nothing,
but if the spinlock was concurrently acquired by another process, it
could lead to more serious issues. Fortunately, with the
--disable-spinlocks emulation implementation, it caused more visible
failures.

In the passing, fix a type in comment and add an assertion that the
procNumber passed to SendProcSignal looks valid.

Discussion: https://www.postgresql.org/message-id/b8ce284c-18a2-4a79-afd3-1991a2e7d246@iki.fi

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/0393f542d72c6182271c392d9a83d0fc775113c7

Modified Files
--------------
src/backend/storage/ipc/procsignal.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Heikki Linnakangas 2024-07-29 15:28:43 Re: pgsql: Move cancel key generation to after forking the backend
Previous Message Heikki Linnakangas 2024-07-29 14:30:01 Re: pgsql: Move cancel key generation to after forking the backend

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2024-07-29 15:31:56 Re: pgsql: Fix double-release of spinlock
Previous Message Andreas Karlsson 2024-07-29 15:06:40 Re: Remove dead code generation tools in src/backend/utils/mb/