Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rRab2-0084BP-GX for pgsql-hackers@arkaria.postgresql.org; Sun, 21 Jan 2024 16:22:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rRaa0-00FrYX-ME for pgsql-hackers@arkaria.postgresql.org; Sun, 21 Jan 2024 16:21:52 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rRaa0-00FrYO-BI for pgsql-hackers@lists.postgresql.org; Sun, 21 Jan 2024 16:21:52 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rRaZx-002eQv-V7 for pgsql-hackers@postgresql.org; Sun, 21 Jan 2024 16:21:51 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 40LGLkqE3348870; Sun, 21 Jan 2024 11:21:46 -0500 From: Tom Lane To: Nathan Bossart cc: Bharath Rupireddy , Abhijit Menon-Sen , Michael Paquier , Robert Haas , pgsql-hackers@postgresql.org Subject: Re: introduce dynamic shared memory registry In-reply-to: <20240119204636.GA1178173@nathanxps13> References: <20240108171627.GA2611898@nathanxps13> <20240112172152.GA3803561@nathanxps13> <20240112194555.GA3804945@nathanxps13> <20240113214124.GA4162765@nathanxps13> <20240116160748.GB100542@nathanxps13> <20240119204636.GA1178173@nathanxps13> Comments: In-reply-to Nathan Bossart message dated "Fri, 19 Jan 2024 14:46:36 -0600" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3348868.1705854106.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Sun, 21 Jan 2024 11:21:46 -0500 Message-ID: <3348869.1705854106@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Nathan Bossart 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_registr= y.c: 185 in GetNamedDSMSegment() 179 } 180 else if (!dsm_find_mapping(entry->handle)) 181 { 182 /* Attach to existing segment. */ 183 dsm_segment *seg =3D dsm_attach(entry->handle); 184 = >>> CID 1586660: Null pointer dereferences (NULL_RETURNS) >>> Dereferencing a pointer that might be "NULL" "seg" when calling "d= sm_pin_mapping". 185 dsm_pin_mapping(seg); 186 ret =3D 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