From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andres Freund <andres@anarazel.de>
Cc: dan-eli@mail.ru
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #18785: Pointer bmr.rel, dereferenced by passing as 1st parameter to function is checked for NULL later
Date: Tue, 28 Jan 2025 15:04:35 -0500
Message-ID: <1414969.1738094675@sss.pgh.pa.us> (raw)
In-Reply-To: <a6oxxee6blexicuark46yydtaqulsjvkrwkri6aic4vbofjxse@4a6j4kuwda7u>
References: <18785-916b89e64ced06e1@postgresql.org>
<a6oxxee6blexicuark46yydtaqulsjvkrwkri6aic4vbofjxse@4a6j4kuwda7u>
Andres Freund <andres@anarazel.de> writes:
> On 2025-01-28 13:58:13 +0000, PG Bug reporting form wrote:
>> Hello, I suggest the following patch for this issue.
>>
>> @@ -905,6 +905,8 @@ ExtendBufferedRelTo(BufferManagerRelation bmr,
>> bmr.smgr->smgr_cached_nblocks[fork] == InvalidBlockNumber)
>> &&
>> !smgrexists(bmr.smgr, fork))
>> {
>> +
>> + Assert(bmr.rel != NULL);
>> LockRelationForExtension(bmr.rel, ExclusiveLock);
> I guess it couldn't hurt to add them. It's fine for existing callers...
Seems quite pointless really. If bmr.rel is NULL, the
LockRelationForExtension call will SIGSEGV all by itself.
Transforming that into a SIGABRT isn't moving the football much.
The actually interesting question is whether it's possible to
reach there with bmr.rel being NULL, and if so what we have to do
to avoid such a crash. Adding an Assert still doesn't help.
regards, tom lane
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-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, andres@anarazel.de, dan-eli@mail.ru, pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #18785: Pointer bmr.rel, dereferenced by passing as 1st parameter to function is checked for NULL later
In-Reply-To: <1414969.1738094675@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