uninitialized values in revised prepared xact code - Mailing list pgsql-hackers

From Andres Freund
Subject uninitialized values in revised prepared xact code
Date
Msg-id 20140630095859.GK26930@awork2.anarazel.de
Whole thread Raw
Responses Re: uninitialized values in revised prepared xact code  (Bruce Momjian <bruce@momjian.us>)
List pgsql-hackers
Hi,

I've just rerun valgrind for the first time in a while and saw the
following splat. My guess is it exists since bb38fb0d43c, but that's
blindly guessing:

==2049== Use of uninitialised value of size 8
==2049==    at 0x4FE66D: EndPrepare (twophase.c:1063)
==2049==    by 0x4F231B: PrepareTransaction (xact.c:2217)
==2049==    by 0x4F2A38: CommitTransactionCommand (xact.c:2676)
==2049==    by 0x79013E: finish_xact_command (postgres.c:2408)
==2049==    by 0x78DE97: exec_simple_query (postgres.c:1062)
==2049==    by 0x791FDD: PostgresMain (postgres.c:4010)
==2049==    by 0x71B13B: BackendRun (postmaster.c:4113)
==2049==    by 0x71A86D: BackendStartup (postmaster.c:3787)
==2049==    by 0x71714C: ServerLoop (postmaster.c:1566)
==2049==    by 0x716804: PostmasterMain (postmaster.c:1219)
==2049==    by 0x679405: main (main.c:219)
==2049==  Uninitialised value was created by a stack allocation
==2049==    at 0x4FE16C: StartPrepare (twophase.c:942)
==2049==
==2049== Syscall param write(buf) points to uninitialised byte(s)
==2049==    at 0x5C69640: __write_nocancel (syscall-template.S:81)
==2049==    by 0x4FE6AE: EndPrepare (twophase.c:1064)
==2049==    by 0x4F231B: PrepareTransaction (xact.c:2217)
==2049==    by 0x4F2A38: CommitTransactionCommand (xact.c:2676)
==2049==    by 0x79013E: finish_xact_command (postgres.c:2408)
==2049==    by 0x78DE97: exec_simple_query (postgres.c:1062)
==2049==    by 0x791FDD: PostgresMain (postgres.c:4010)
==2049==    by 0x71B13B: BackendRun (postmaster.c:4113)
==2049==    by 0x71A86D: BackendStartup (postmaster.c:3787)
==2049==    by 0x71714C: ServerLoop (postmaster.c:1566)
==2049==    by 0x716804: PostmasterMain (postmaster.c:1219)
==2049==    by 0x679405: main (main.c:219)
==2049==  Address 0x64694ed is 1,389 bytes inside a block of size 8,192 alloc'd
==2049==    at 0x4C27B8F: malloc (vg_replace_malloc.c:298)
==2049==    by 0x8E766E: AllocSetAlloc (aset.c:853)
==2049==    by 0x8E8E04: MemoryContextAllocZero (mcxt.c:627)
==2049==    by 0x8A54D3: AtStart_Inval (inval.c:704)
==2049==    by 0x4F1DFC: StartTransaction (xact.c:1841)
==2049==    by 0x4F28D1: StartTransactionCommand (xact.c:2529)
==2049==    by 0x7900A7: start_xact_command (postgres.c:2383)
==2049==    by 0x78DAF4: exec_simple_query (postgres.c:860)
==2049==    by 0x791FDD: PostgresMain (postgres.c:4010)
==2049==    by 0x71B13B: BackendRun (postmaster.c:4113)
==2049==    by 0x71A86D: BackendStartup (postmaster.c:3787)
==2049==    by 0x71714C: ServerLoop (postmaster.c:1566)
==2049==  Uninitialised value was created by a stack allocation
==2049==    at 0x4FE16C: StartPrepare (twophase.c:942)

It's probably just padding - twophase.c:1063 is the CRC32 computation of
the record data.

Greetings,

Andres Freund

--Andres Freund                       http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training &
Services



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: better atomics - v0.5
Next
From: Asif Naeem
Date:
Subject: Re: Extending MSVC scripts to support --with-extra-version