Re: ExecAppendAsyncEventWait() in REL_14_STABLE can corrupt PG_exception_stack

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Alexander Pyhalov <a(dot)pyhalov(at)postgrespro(dot)ru>
Cc: Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: ExecAppendAsyncEventWait() in REL_14_STABLE can corrupt PG_exception_stack
Date: 2024-02-24 01:06:29
Message-ID: ZdlBFS25eKruiQvO@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Feb 23, 2024 at 01:21:14PM +0300, Alexander Pyhalov wrote:
> Recent commit 555276f8594087ba15e0d58e38cd2186b9f39f6d introduced final
> cleanup of node->as_eventset in ExecAppendAsyncEventWait().
> Unfortunately, now this function can return in the middle of TRY/FINALLY
> block, without restoring PG_exception_stack.
>
> We found this while working on our FDW. Unfortunately, I couldn't reproduce
> the issue with postgres_fdw, but it seems it is also affected.

Ugh, yes, you are obviously right that the early return is wrong.
I'll look into fixing that where appropriate. Thanks for the report,
Alexander!
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2024-02-24 01:15:12 Re: Potential issue in ecpg-informix decimal converting functions
Previous Message Jacob Champion 2024-02-24 01:01:28 Re: [PoC] Federated Authn/z with OAUTHBEARER