Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fvWVZ-0001Eu-Nt for pgsql-hackers@arkaria.postgresql.org; Thu, 30 Aug 2018 23:37:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fvWVX-0006kJ-QP for pgsql-hackers@arkaria.postgresql.org; Thu, 30 Aug 2018 23:37:47 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fvWVX-0006kB-JT for pgsql-hackers@lists.postgresql.org; Thu, 30 Aug 2018 23:37:47 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fvWVU-0005Kc-VD for pgsql-hackers@postgresql.org; Thu, 30 Aug 2018 23:37:47 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w7UNbbwE012124; Thu, 30 Aug 2018 19:37:37 -0400 From: Tom Lane To: Michael Paquier cc: Fabien COELHO , Michael Banck , pgsql-hackers Subject: Re: pg_verify_checksums and -fno-strict-aliasing In-reply-to: <20180830175652.GC15446@paquier.xyz> References: <1535618100.1286.3.camel@credativ.de> <7321.1535639966@sss.pgh.pa.us> <20180830175652.GC15446@paquier.xyz> Comments: In-reply-to Michael Paquier message dated "Thu, 30 Aug 2018 10:56:52 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <12122.1535672257.1@sss.pgh.pa.us> Date: Thu, 30 Aug 2018 19:37:37 -0400 Message-ID: <12123.1535672257@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Michael Paquier writes: > On Thu, Aug 30, 2018 at 10:39:26AM -0400, Tom Lane wrote: >> (The right fix, of course, is to malloc the work buffer rather than >> put it on the stack.) > pg_upgrade/file.c is careful about that (5afcd2a), and has a comment on > the matter, as does pg_standby.c. > Now, grepping around for "BLCKSZ]", some garbage may have accumulated? Ah, that's a cute idea for finding trouble spots. > - entrySplitPage in ginentrypage.c > - rewind_copy_file_range in file.c > - _hash_alloc_buckets in hashpage.c > - pg_prewarm.c > - blinsert.c > - pg_waldump.c > - logtape.c Some of these are safe, I think, because the buffers are only used as targets for read() and write(). But some are definitely broken. My own list of files that seem to have issues is blinsert.c generic_xlog.c ginentrypage.c hashpage.c pg_verify_checksums.c pg_waldump.c xloginsert.c The fact that some of these are pretty old and we've not noticed is not good. It suggests that we don't currently have any compilers in the buildfarm that under-align char[] arrays on the stack, which seems like a gotcha waiting to bite us. I wonder if there is any way to persuade some compiler on a non-Intel box to do that. Anyway, I'll work on a patch for that, unless you were on it already? regards, tom lane