pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruce Momjian <bruce@momjian.us>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Mike Wilson <mfwilson@gmail.com>
Cc: PostgreSQL-development <pgsql-hackers@postgreSQL.org>
Subject: Re: [BUGS] BUG #6733: All Tables Empty After pg_upgrade (PG 9.2.0 beta 2)
Date: Wed, 25 Jul 2012 16:38:16 -0400
Message-ID: <20120725203816.GA21271@momjian.us> (raw)
In-Reply-To: <2736.1343246982@sss.pgh.pa.us>
References: <8D0918C1-39A0-429A-96DB-997BE362141A@gmail.com>
	<20120717205949.GA8146@momjian.us>
	<1857E88C-CD2D-4C44-B04B-82256B4E9959@gmail.com>
	<13524.1342576944@sss.pgh.pa.us>
	<20120718025856.GA29978@momjian.us>
	<14913.1342583940@sss.pgh.pa.us>
	<17278.1342589434@sss.pgh.pa.us>
	<20120719062436.GA5058@momjian.us>
	<20120725170113.GA22286@momjian.us>
	<2736.1343246982@sss.pgh.pa.us>

On Wed, Jul 25, 2012 at 04:09:42PM -0400, Tom Lane wrote:
> Bruce Momjian <bruce@momjian.us> writes:
> > On Thu, Jul 19, 2012 at 02:24:36AM -0400, Bruce Momjian wrote:
> >> On Wed, Jul 18, 2012 at 01:30:34AM -0400, Tom Lane wrote:
> >>> Some googling suggests that on Solaris, this calculation would actually
> >>> give a result that's a little too *large* not too small, because of
> >>> padding in the declaration of struct dirent.  That would not be a
> >>> problem so far as callers were concerned, but it's conceivable that the
> >>> memcpy in load_directory would run off the end of memory and crash.
> 
> > This bug report was fixed mostly via private email because a private
> > schema dump was sent to Tom and me.  Tom fixed the problem by changing
> > the way we interact with struct dirent, but neither of us is sure
> > exactly why the fix worked.  It is something about Solaris.
> 
> I'm quite sure that the explanation is as above, that is, we were
> computing an incorrectly large value for the length of the directory
> entry, and that ran off the end of a memory-mapped directory page.
> The actual length of the entry, for a five-character file name,
> would be offsetof(d_name) plus 6 bytes, which assuming the entry
> requires 4-byte alignment would pad to offsetof(d_name) plus 8;
> but we were computing offsetof(d_name) plus 9 bytes, just enough
> to try to fetch a byte that wasn't there.

OK.

> > Tom suggested that load_directory() return a (char *) array, rather than
> > a struct dirent array, greatly simplifying the code.
> > I have done this in the attached patch, and because of the uncertainty
> > of ths fix, I would like to apply this to 9.2 as well.
> 
> I think patching 9.2 is reasonable, but on the grounds of keeping it
> parallel to HEAD, not that we don't know why the previous code was
> broken.

Agreed.

-- 
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + It's impossible for everything to be true. +



view thread (23+ messages)  latest in thread

Message-ID: <20120725203816.GA21271@momjian.us>
Permalink:  ../20120725203816.GA21271@momjian.us/
Also on:    postgresql.org/message-id/20120725203816.GA21271@momjian.us

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: bruce@momjian.us, tgl@sss.pgh.pa.us, mfwilson@gmail.com, pgsql-hackers@postgreSQL.org
  Subject: Re: [BUGS] BUG #6733: All Tables Empty After pg_upgrade (PG 9.2.0 beta 2)
  In-Reply-To: <20120725203816.GA21271@momjian.us>
  References: <8D0918C1-39A0-429A-96DB-997BE362141A@gmail.com> <20120717205949.GA8146@momjian.us> <1857E88C-CD2D-4C44-B04B-82256B4E9959@gmail.com> <13524.1342576944@sss.pgh.pa.us> <20120718025856.GA29978@momjian.us> <14913.1342583940@sss.pgh.pa.us> <17278.1342589434@sss.pgh.pa.us> <20120719062436.GA5058@momjian.us> <20120725170113.GA22286@momjian.us> <2736.1343246982@sss.pgh.pa.us> <20120725203816.GA21271@momjian.us>

* 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