Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wRQc7-002Ks4-1q for pgsql-hackers@arkaria.postgresql.org; Mon, 25 May 2026 08:24:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wRQc5-000oUr-1V for pgsql-hackers@arkaria.postgresql.org; Mon, 25 May 2026 08:24:42 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wRQc5-000oUj-0A for pgsql-hackers@lists.postgresql.org; Mon, 25 May 2026 08:24:42 +0000 Received: from mail-yx1-xb12c.google.com ([2607:f8b0:4864:20::b12c]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wRQc4-00000000fpA-1Gbe for pgsql-hackers@lists.postgresql.org; Mon, 25 May 2026 08:24:41 +0000 Received: by mail-yx1-xb12c.google.com with SMTP id 956f58d0204a3-65890a6ca20so10114397d50.0 for ; Mon, 25 May 2026 01:24:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1779697479; cv=none; d=google.com; s=arc-20240605; b=hkVcFE52R45x54HFI0HWQPUwBtlyVkNuOcIFYwJMPqze51jteoTSXf9huE/b310vKc BndZpgA0/h/WjCv/Es/Wu/r+BUQ+m6dqRuMZlEYIdNkJIvAvFkp1SUCbPnlUdWjfQ659 +3S52tf7XIKtSLDlp910bc7hc/PaSD3ksjFs0oXYECouiu5Ne9IoACqJ3Nj8kMaang+7 NKLeO4LlU2o/RRtXZcUnxWCOcoywf+LeUxqLoWVmHM7qi+Vk5B8b6xHsV0pAhcZz3bnG l+zjGsdSkhiIskPMPQpgcuZgnPZpNv//AmrBQYygl4oG+7du2mtt45sjTR1VCfBvQY7t IlOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=s5V1l7hw6xTtpyv4zvIrQzclmljIwQ6/Ww0uGLrCovA=; fh=cKv3Gj9IlEaazVYgaN4w2o1VSi2YXQPt0KpgozySuHA=; b=lOkWdCzZK6n0aqC2upzHxWsQgyA+g3oBZjyGKaIzfXgRpcC2FOBtR5yO+4fCP82SYl KqCGHX7d6Ahhc9bOEOLNWOqg1jMqJA/Z2e3q1cL8eOuuewegwdAxDWIjgPFXRluYDgpE iFP1AvcxGireKzAR02Brz+sv1y5ALDouXrDsR9iQ+DbGYmXalgKlgERTkzragKi3bqyb 6IMlBrkP2NXXW7z1itij9xZ/hGLCtyMQeyvGKg3DTv11gmpH0tx7sHQ+RU3OZ1Rbm09H wCTFunVToKB1pI7P1GaK1QrTOZ5DhLyCw99gprh1vbYBHic7Mt9FnIGGABhInk6PiWkc pD+w==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779697479; x=1780302279; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=s5V1l7hw6xTtpyv4zvIrQzclmljIwQ6/Ww0uGLrCovA=; b=NjQld91tWfrWtrv5AajpgpoRuZ5UJqSM65E+O82uyBs26xquwB/8SBWmhoqrbGKfDv QpOgq+xRgIGUZfyWDCsqg/ryZ3vySt0Eu6/ZppRgrFlXJnNIi4mF7mfoeIsgAC/OJ2Zi NmxChl+Abale3SsMwT8roWCm3wF8k1awKlJjojMsn4Sdxnvm2KgCAg5nhghnynjG8ssP a7/aiq0jMSKFKVC1mBUQhRpzAyDo7VWVYaxUsXRY3KEyNcehEWRsoDI8piy6jkETtut+ 90odpBCCrcoreDZmHWFUS+N3PbO/7aCx//el/D9DuckEMxfU1qGSmoT5TKD7ABbjFKjq woUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779697479; x=1780302279; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=s5V1l7hw6xTtpyv4zvIrQzclmljIwQ6/Ww0uGLrCovA=; b=nEaUpc7jyu4cC3kkmHLnPGp5Kmbjaz3Rq/d+aj+b14vZxGY8wuyMVsgQN2Qq1F6HG8 jWZFoLXKMskxr2l23qKbmM3DuQkX9bsrdeSDSRxJbJTC33JvuWRF9yZZcr1BujjzlsOH XwtavwRK63GCNlA9mzF50Opel9uzOqeoE583UUDMkn8Wc+c7XTt4IswfFp6uD5XynqxT Wl9F8P5AZ5ZeaWqwb8UjD4eEZUDzs6rHHEbP+88I7ViMYAQzczA5CCAGmSmYdrEtz7cH PQ5+KteeeZjS1KNhjJXWBRuzUyBD+sVLlgaqV6xTQMOZhRsT46aqyfsfUfboOOz7BPJz sdkQ== X-Gm-Message-State: AOJu0YxLrgC7T0wqk6tc6M7NJff8v+0uiWz7BATRH7dvAKXCC1x/S1Ml KWWlkGAn399yy0ZJujhpuJNwvnLCUTaQDIEeD/5xNYYN1i7GGG521df83YqJEQ0c1aBBQAJODZ9 oIXI0HXdLPeipx8zgjp8G5BcuIcQoFqO2ul7Z X-Gm-Gg: Acq92OE/Fu3FFvLZpHRks4KLhbTQdqc6PFFKlydRhIjvvS4KqLwSlbfZhCkn3A7eLOC O5ET8vmahMDs6FxXk0uJVNYgVIwyKdNxILl7J1mTLdc74O/w4bWbUd0+TazlQ3sS4NHQhrACnag uE8jBC0buWBeEkb54rmRNNe3hn1pjd9b04RkBycOzKT6SeYXrXZkMvwX8A172i3xvEGsVKxT8gS YUIMWWzb+sFcQXrWN1hjVXEodHSIVTTIzc1cGmZSR/Qo3lJQJSqrWWM8w++iF2Vk31CQyG+BsVT g0SUnn4= X-Received: by 2002:a53:accd:0:20b0:65e:21b9:e6a9 with SMTP id 956f58d0204a3-65ec998a138mr10463284d50.62.1779697478609; Mon, 25 May 2026 01:24:38 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Ayush Tiwari Date: Mon, 25 May 2026 13:54:28 +0530 X-Gm-Features: AVHnY4Jp_kk08prT8IJ3Ym-VHbwTl6oH__shunSd2Oz06DQ5NkcA5yZ5vVhDIoo Message-ID: Subject: Re: NULL pointer dereference in syslogger with load_libraries() and -DEXEC_BACKEND at startup To: Michael Paquier Cc: Postgres hackers Content-Type: multipart/alternative; boundary="000000000000052f6a0652a01c82" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000052f6a0652a01c82 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi, On Mon, 25 May 2026 at 13:52, Michael Paquier wrote: > On Mon, May 25, 2026 at 04:45:41PM +0900, Michael Paquier wrote: > > I did not take the cycles necessary for a bisect, but it looks like > > this has been around for a few months at least. I have pinged > > f3c9e341cdf1 as a safe startup point for now, so that's a 2026 issue. > > Well, well: > 0c8e082fba8d36434552d3d7800abda54acafd57 is the first bad commit > committer: =C3=81lvaro Herrera > date: Wed, 4 Feb 2026 16:56:57 +0100 > Assign "backend" type earlier during process start-up > > I have also checked manually a revert of this commit, and saw that the > problem is gone, so it does not look like I have messed up my bisect. > I was doing a Binary search to look for commits around those paths. I also checked 0c8e082fba8 directly: its parent starts clean with the same setup, while 0c8e082fba8 reports the NULL pointer passed to fwrite(). So this looks to be caused by 0c8e082fba8. After that commit, the syslogger child sets MyBackendType =3D B_LOGGER in SubPostmasterMain(), before process_shared_preload_libraries(). A message emitted from _PG_init() then takes the direct write_syslogger_file() path, but the syslogger FILE handle= s are not reopened until later in SysLoggerMain(). So I think the bad assumption is that MyBackendType =3D=3D B_LOGGER means write_syslogger_file() is ready to use. A fix probably needs to make the direct syslogger-file path conditional on the FILE handles being ready, and that should cover stderr, CSV and JSON paths. Regards, Ayush --000000000000052f6a0652a01c82 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi,

On Mon, 25 May 2= 026 at 13:52, Michael Paquier <mi= chael@paquier.xyz> wrote:
On Mon, May 25, 2026 at 04:45:41PM +0900, Michael Paquier = wrote:
> I did not take the cycles necessary for a bisect, but it looks like > this has been around for a few months at least.=C2=A0 I have pinged > f3c9e341cdf1 as a safe startup point for now, so that's a 2026 iss= ue.

Well, well:
0c8e082fba8d36434552d3d7800abda54acafd57 is the first bad commit
committer: =C3=81lvaro Herrera <alvherre@kurilemu.de>
date: Wed, 4 Feb 2026 16:56:57 +0100
Assign "backend" type earlier during process start-up

I have also checked manually a revert of this commit, and saw that the
problem is gone, so it does not look like I have messed up my bisect.

I was doing a Binary search to=C2=A0look for= commits around those paths.

I also checked 0c8e082fba8= directly: its parent starts clean with the
same setup, while 0c8e082fba8 reports the NULL point= er passed to fwrite().

So this looks to be caused by 0c8e082fba8.=C2= =A0 After that commit, the syslogger=C2=A0
child sets MyBackendType =3D B_LOGGER in SubPostmaste= rMain(), before
process_shared_preload_libraries().=C2=A0 A message emit= ted from _PG_init() then
takes the direct write_syslogger_file() path, b= ut the syslogger FILE handles
are not reopened until later in SysLoggerM= ain().

So I think the bad assumption is that MyBackendType =3D=3D B_= LOGGER means
write_syslogger_file() is ready to use.=C2=A0 A fix probabl= y needs to make the
direct syslogger-file path conditional on the FILE h= andles being ready, and
that should cover stderr, CSV and JSON paths.
Regards,
Ayush=C2=A0
--000000000000052f6a0652a01c82--