pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alexander Lakhin <exclusion@gmail.com>
To: Amit Kapila <amit.kapila16@gmail.com>
To: Hayato Kuroda (Fujitsu) <kuroda.hayato@fujitsu.com>
Cc: Michael Paquier <michael@paquier.xyz>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Jeff Davis <pgsql@j-davis.com>
Cc: Heikki Linnakangas <hlinnaka@iki.fi>
Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
Subject: Re: Is this a problem in GenericXLogFinish()?
Date: Wed, 29 Nov 2023 18:00:01 +0300
Message-ID: <62ed1a9f-746a-8e86-904b-51b9b806a1d9@gmail.com> (raw)
In-Reply-To: <CA+TgmobSARYNQHvOHrehH-+YHkLGWdqJkuxrnDHCcviOYZ+Qgw@mail.gmail.com>
References: <CA+TgmobjyWDQfiMLj1_Lf0GheiY0SaOEPbFEepfa3G-XOLmHOA@mail.gmail.com>
	<ZToVxyLSVUisFPp0@paquier.xyz>
	<CA+TgmoZ8X60+mR4jhS4LoQ1Jf-amSS0xCyfu=p7f94t7HoiH2g@mail.gmail.com>
	<ZTsBF-TKekQIFeL6@paquier.xyz>
	<CAA4eK1+5jacq3g-fcVM2VTKt72SerQ5XuGV5rcrVNG1q7Shr+A@mail.gmail.com>
	<ZTzpsFEV3DhlmxX5@paquier.xyz>
	<CAA4eK1+use8DaXfgEwRiM7CnEk83d_FZCMf4qK7DZ8Hbt2vhzg@mail.gmail.com>
	<ZUH9F6i-TtlJ6gw7@paquier.xyz>
	<CAA4eK1KH1LKhgA_i3akFtTV0NqSAG-N=ttm3ravBcjPWGkbZ+w@mail.gmail.com>
	<TYAPR01MB58667885EE61EFB2844820DDF5AAA@TYAPR01MB5866.jpnprd01.prod.outlook.com>
	<TYAPR01MB58668D6E367C6C57B515E965F5AAA@TYAPR01MB5866.jpnprd01.prod.outlook.com>
	<TYAPR01MB58663DB52ED18495A5AD1338F5AEA@TYAPR01MB5866.jpnprd01.prod.outlook.com>
	<CAA4eK1J1vxqwMfETXN43_0xiHd51=ryM=aVXgq+PWa7RoUnwdw@mail.gmail.com>
	<TYAPR01MB5866CE98DC1339C42E45C2ACF5B3A@TYAPR01MB5866.jpnprd01.prod.outlook.com>
	<CA+TgmobSARYNQHvOHrehH-+YHkLGWdqJkuxrnDHCcviOYZ+Qgw@mail.gmail.com>

Hello,

13.11.2023 20:21, Robert Haas wrote:
> On Mon, Nov 13, 2023 at 12:47 AM Hayato Kuroda (Fujitsu)
> <kuroda.hayato@fujitsu.com> wrote:
>> Moved.
> I see that this patch was committed, but I'm not very convinced that
> the approach is correct. The comment says this:
>

I've discovered that that patch introduced a code path leading to an
uninitialized memory access.
With the following addition to hash_index.sql:
  -- Fill overflow pages by "dead" tuples.
  BEGIN;
  INSERT INTO hash_cleanup_heap SELECT 1 FROM generate_series(1, 1000) as i;
+INSERT INTO hash_cleanup_heap SELECT 1 FROM generate_series(1, 1000) as i;
  ROLLBACK;
+INSERT INTO hash_cleanup_heap SELECT 1 FROM generate_series(1, 1000) as i;

make check -C src/test/recovery/ PROVE_TESTS="t/027*"
when executed under Valgrind, triggers:
==00:00:02:30.285 97744== Conditional jump or move depends on uninitialised value(s)
==00:00:02:30.285 97744==    at 0x227585: BufferIsValid (bufmgr.h:303)
==00:00:02:30.285 97744==    by 0x227585: hash_xlog_squeeze_page (hash_xlog.c:781)
==00:00:02:30.285 97744==    by 0x228133: hash_redo (hash_xlog.c:1083)
==00:00:02:30.285 97744==    by 0x2C2801: ApplyWalRecord (xlogrecovery.c:1943)
==00:00:02:30.285 97744==    by 0x2C5C52: PerformWalRecovery (xlogrecovery.c:1774)
==00:00:02:30.285 97744==    by 0x2B63A1: StartupXLOG (xlog.c:5559)
==00:00:02:30.285 97744==    by 0x558165: StartupProcessMain (startup.c:282)
==00:00:02:30.285 97744==    by 0x54DFE8: AuxiliaryProcessMain (auxprocess.c:141)
==00:00:02:30.285 97744==    by 0x5546B0: StartChildProcess (postmaster.c:5331)
==00:00:02:30.285 97744==    by 0x557A53: PostmasterMain (postmaster.c:1458)
==00:00:02:30.285 97744==    by 0x4720C2: main (main.c:198)
==00:00:02:30.285 97744==
(in 027_stream_regress_standby_1.log)

That is, when line
https://coverage.postgresql.org/src/backend/access/hash/hash_xlog.c.gcov.html#661
is reached, writebuf stays uninitialized.

Best regards,
Alexander





view thread (64+ messages)  latest in thread

Message-ID: <62ed1a9f-746a-8e86-904b-51b9b806a1d9@gmail.com>
Permalink:  ../62ed1a9f-746a-8e86-904b-51b9b806a1d9@gmail.com/
Also on:    postgresql.org/message-id/62ed1a9f-746a-8e86-904b-51b9b806a1d9@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: exclusion@gmail.com, amit.kapila16@gmail.com, kuroda.hayato@fujitsu.com, michael@paquier.xyz, robertmhaas@gmail.com, pgsql@j-davis.com, hlinnaka@iki.fi
  Subject: Re: Is this a problem in GenericXLogFinish()?
  In-Reply-To: <62ed1a9f-746a-8e86-904b-51b9b806a1d9@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox