Bug in WaitForBackgroundWorkerShutdown() [REL9_5_STABLE]

From: Dmitry Ivanov <d(dot)ivanov(at)postgrespro(dot)ru>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Bug in WaitForBackgroundWorkerShutdown() [REL9_5_STABLE]
Date: 2016-08-04 11:44:08
Message-ID: 1637882.WfYN5gPf1A@abook
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Recently I've encountered a strange crash while calling elog(ERROR, "...")
after the WaitForBackgroundWorkerShutdown() function. It turns out that
_returns_ inside the PG_TRY()..PG_CATCH() block are *highly* undesirable,
since they leave PG_exception_stack pointing to a local struct in a dead
frame, which is an obvious UB. I've attached a patch which fixes this behavior
in the aforementioned function, but there might be more errors like that
elsewhere.

--
Dmitry Ivanov
Postgres Professional: http://www.postgrespro.com
Russian Postgres Company

Attachment Content-Type Size
fix_WaitForBackgroundWorkerShutdown_v1.patch text/x-patch 650 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dmitry Ivanov 2016-08-04 11:47:59 Re: Bug in WaitForBackgroundWorkerShutdown() [REL9_5_STABLE]
Previous Message Ildar Musin 2016-08-04 11:28:30 Unused argument in PinBuffer function