Re: NULL pointer dereference in syslogger with load_libraries() and -DEXEC_BACKEND at startup

From: Alvaro Herrera <alvherre(at)kurilemu(dot)de>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, euler(at)eulerto(dot)com, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: NULL pointer dereference in syslogger with load_libraries() and -DEXEC_BACKEND at startup
Date: 2026-05-26 11:09:13
Message-ID: ahV9KzLOqvOw78C3@alvherre.pgsql
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2026-May-26, Michael Paquier wrote:

> This issue is different, it is a Postgres logic bug, so adding an
> exception like the one you are suggesting is just a shortcut hiding
> the real issue: the log file is not ready yet, but the syslogger is
> invoked at a point when it thinks the log file exists.

I think we can solve this easily by flipping a new Boolean value at the
same point were MyBackendType was previously set. The attached POC
fixes the scenario you described; can you confirm? It needs some
additional comments, of course.

(There is one more place in elog.c where we check that MyBackendType is
_not_ B_LOGGER, but I think that one is correct as-is; and I'm wondering
if that would behave correctly before 0c8e082fba8d.)

--
Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/
“Cuando no hay humildad las personas se degradan” (A. Christie)

Attachment Content-Type Size
0001-POC-syslogger-add-Boolean-state-indicating-readiness.patch text/x-diff 2.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Shruthi Gowda 2026-05-26 11:40:02 Re: [BUG] CRASH: ECPGprepared_statement() and ECPGdeallocate_all() when connection is NULL
Previous Message Jim Jones 2026-05-26 10:02:45 Re: Avoid leaking system path from pg_available_extensions