pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andres Freund <andres@anarazel.de>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Heikki Linnakangas <heikki.linnakangas@iki.fi>
Cc: pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Fix double-release of spinlock
Date: Mon, 29 Jul 2024 09:18:46 -0700
Message-ID: <20240729161846.kgiafbe2dtgabxgb@awork3.anarazel.de> (raw)
In-Reply-To: <2600757.1722267116@sss.pgh.pa.us>
References: <E1sYSF2-001lEB-D1@gemulon.postgresql.org>
	<2600757.1722267116@sss.pgh.pa.us>

Hi,

On 2024-07-29 11:31:56 -0400, Tom Lane wrote:
> Heikki Linnakangas <heikki.linnakangas@iki.fi> writes:
> > 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.
> 
> There was some recent discussion about getting rid of
> --disable-spinlocks on the grounds that nobody would use
> hardware that lacked native spinlocks.  But now I wonder
> if there is a testing/debugging reason to keep it.

Seems it'd be a lot more straightforward to just add an assertion to the
x86-64 spinlock implementation verifying that the spinlock isn't already free?

Greetings,

Andres Freund





view thread (9+ messages)  latest in thread

Message-ID: <20240729161846.kgiafbe2dtgabxgb@awork3.anarazel.de>
Permalink:  ../20240729161846.kgiafbe2dtgabxgb@awork3.anarazel.de/
Also on:    postgresql.org/message-id/20240729161846.kgiafbe2dtgabxgb@awork3.anarazel.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: andres@anarazel.de, tgl@sss.pgh.pa.us, heikki.linnakangas@iki.fi
  Subject: Re: pgsql: Fix double-release of spinlock
  In-Reply-To: <20240729161846.kgiafbe2dtgabxgb@awork3.anarazel.de>
  References: <E1sYSF2-001lEB-D1@gemulon.postgresql.org> <2600757.1722267116@sss.pgh.pa.us> <20240729161846.kgiafbe2dtgabxgb@awork3.anarazel.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox