Re: introduce dynamic shared memory registry
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Nathan Bossart <nathandbossart@gmail.com>
Cc: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>,
Abhijit Menon-Sen <ams@toroid.org>,
Michael Paquier <michael@paquier.xyz>,
Robert Haas <robertmhaas@gmail.com>, pgsql-hackers@postgresql.org
Date: 2024-01-21T16:21:46Z
Lists: pgsql-hackers
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
Commits
-
Fix possible NULL pointer dereference in GetNamedDSMSegment().
- 4372adfa24f2 17.0 landed
-
Teach autoprewarm to use the dynamic shared memory registry.
- abb0b4fc03fc 17.0 landed
-
Introduce the dynamic shared memory registry.
- 8b2bcf3f287c 17.0 landed
-
doc: Reorganize section for shared memory and LWLocks.
- 964152c476f2 17.0 landed