Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ndyDa-0003JZ-6F for pgsql-bugs@arkaria.postgresql.org; Mon, 11 Apr 2022 17:52:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ndyCZ-0006NN-UL for pgsql-bugs@arkaria.postgresql.org; Mon, 11 Apr 2022 17:51:47 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ndyCZ-0006NE-MR for pgsql-bugs@lists.postgresql.org; Mon, 11 Apr 2022 17:51:47 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ndyCW-0003gD-9M for pgsql-bugs@lists.postgresql.org; Mon, 11 Apr 2022 17:51:46 +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 23BHpcPl352841; Mon, 11 Apr 2022 13:51:38 -0400 From: Tom Lane To: Andres Freund cc: anisimow.d@gmail.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #17462: Invalid memory access in heapam_tuple_lock In-reply-to: <20220411173417.ocwjn5xrkqqjiysl@alap3.anarazel.de> References: <17462-9c98a0f00df9bd36@postgresql.org> <286748.1649692519@sss.pgh.pa.us> <288544.1649693991@sss.pgh.pa.us> <20220411173417.ocwjn5xrkqqjiysl@alap3.anarazel.de> Comments: In-reply-to Andres Freund message dated "Mon, 11 Apr 2022 10:34:17 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <352839.1649699498.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Mon, 11 Apr 2022 13:51:38 -0400 Message-ID: <352840.1649699498@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Andres Freund writes: > One way to address it in a way not requiring an API break would be to pa= ss > SnapshotAny to heap_fetch and then do an explicit visibility check "ours= elves" > in heapam_lock_tuple(). I'm not really interested in fixing this without an API break (going forward anyway), because as it stands heap_fetch is just an invitation to make this same mistake again. It should never return a tuple pointer if we don't keep the pin on the associated buffer. regards, tom lane