pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Nathan Bossart <nathandbossart@gmail.com>
Cc: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Cc: Abhijit Menon-Sen <ams@toroid.org>
Cc: Michael Paquier <michael@paquier.xyz>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: pgsql-hackers@postgresql.org
Subject: Re: introduce dynamic shared memory registry
Date: Sun, 21 Jan 2024 11:21:46 -0500
Message-ID: <3348869.1705854106@sss.pgh.pa.us> (raw)
In-Reply-To: <20240119204636.GA1178173@nathanxps13>
References: <20240108171627.GA2611898@nathanxps13>
	<ZZ94oH_5L2rFAywl@paquier.xyz>
	<CALj2ACVaFuUys-Fkq8SQDpTOJnmaqO6C8RshbYtbW-DJD7LbAA@mail.gmail.com>
	<20240112172152.GA3803561@nathanxps13>
	<ZaF6UpYImGqVIhVp@toroid.org>
	<20240112194555.GA3804945@nathanxps13>
	<20240113214124.GA4162765@nathanxps13>
	<CALj2ACVKFPm7nCrHMko7JJpsFJU23abzYyMS8S2Pz8r4M=rW7w@mail.gmail.com>
	<20240116160748.GB100542@nathanxps13>
	<CALj2ACWuiAm7Rr13PFfaiQfOHUoCbJOJvU72jyLnj4xfoEOAEg@mail.gmail.com>
	<20240119204636.GA1178173@nathanxps13>

Nathan Bossart <nathandbossart@gmail.com> writes:
> Committed.  Thanks everyone for reviewing!

Coverity complained about this:

*** CID 1586660:  Null pointer dereferences  (NULL_RETURNS)
/srv/coverity/git/pgsql-git/postgresql/src/backend/storage/ipc/dsm_registry.c: 185 in GetNamedDSMSegment()
179     	}
180     	else if (!dsm_find_mapping(entry->handle))
181     	{
182     		/* Attach to existing segment. */
183     		dsm_segment *seg = dsm_attach(entry->handle);
184     
>>>     CID 1586660:  Null pointer dereferences  (NULL_RETURNS)
>>>     Dereferencing a pointer that might be "NULL" "seg" when calling "dsm_pin_mapping".
185     		dsm_pin_mapping(seg);
186     		ret = dsm_segment_address(seg);
187     	}
188     	else
189     	{
190     		/* Return address of an already-attached segment. */

I think it's right --- the comments for dsm_attach explicitly
point out that a NULL return is possible.  You need to handle
that scenario in some way other than SIGSEGV.

			regards, tom lane





view thread (51+ messages)  latest in thread

Message-ID: <3348869.1705854106@sss.pgh.pa.us>
Permalink:  ../3348869.1705854106@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/3348869.1705854106@sss.pgh.pa.us

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, nathandbossart@gmail.com, bharath.rupireddyforpostgres@gmail.com, ams@toroid.org, michael@paquier.xyz, robertmhaas@gmail.com
  Subject: Re: introduce dynamic shared memory registry
  In-Reply-To: <3348869.1705854106@sss.pgh.pa.us>

* 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