Re: Fix crash when non-creator being an iteration on shared radix tree - Mailing list pgsql-hackers

From John Naylor
Subject Re: Fix crash when non-creator being an iteration on shared radix tree
Date
Msg-id CANWCAZaNqdm06ivV87bLnbkwpibUy34xMrDgTXyZSKNWnNR1SA@mail.gmail.com
Whole thread Raw
List pgsql-hackers
On Wed, Dec 18, 2024 at 12:49 AM Masahiko Sawada <sawada.mshk@gmail.com> wrote:
>
> Hi,
>
> I found that a server crashes due to a null-pointer-dereference if a
> process attached to the shared radix tree begins an iteration on it,
> because we don't create the memory context for iter_context at
> RT_ATTACH(). There is no code in the core causing this crash in the
> core since in parallel vacuum, the leader process always creates the
> shared radix tree and begins the iteration. However it could happen in
> external extensions. I've attached the patch to fix it and I think it
> should be backpatched to v17.

+1 in general, but I wonder if instead the iter_context should be
created within RT_BEGIN_ITERATE -- I imagine that would have less
duplication and would be as safe, but I haven't tried it. Is there
some reason not  to do that?

--
John Naylor
Amazon Web Services



pgsql-hackers by date:

Previous
From: Masahiko Sawada
Date:
Subject: Re: Memory leak in WAL sender with pgoutput (v10~)
Next
From: Laurenz Albe
Date:
Subject: Re: Final result (display) collation?