Re: [PATCH] ident authentication fails on kFreeBSD/x86-64 due to wrong struct size

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Martin Pitt <mpitt(at)debian(dot)org>
Cc: PostgreSQL Bugs <pgsql-bugs(at)postgresql(dot)org>, Petr Salinger <Petr(dot)Salinger(at)seznam(dot)cz>, 612888(at)bugs(dot)debian(dot)org
Subject: Re: [PATCH] ident authentication fails on kFreeBSD/x86-64 due to wrong struct size
Date: 2011-05-29 18:49:43
Message-ID: 24639.1306694983@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

I wrote:
> Martin Pitt <mpitt(at)debian(dot)org> writes:
>> /* Compute size without padding */
>> - char cmsgmem[ALIGN(sizeof(struct cmsghdr)) + ALIGN(sizeof(Cred))]; /* for NetBSD */
>> + char cmsgmem[ALIGN(sizeof(struct cmsghdr)) + sizeof(Cred)]; /* for NetBSD */

> Hm. That code's been like that for a very long time (since 2001
> according to the git history...). How much confidence can we have
> that this change won't result in breakage on other flavors of *BSD?

BTW, I wonder whether the real bug isn't on the libpq side instead.
I notice that its idea of the cmsgmem size is not like the backend's:

#ifdef HAVE_STRUCT_CMSGCRED
/* Prevent padding */
char cmsgmem[sizeof(struct cmsghdr) + sizeof(struct cmsgcred)];

This corresponds to the original coding in the backend, but not to what
the code looks like now. The subsequent whacking around of the backend
cmsgmem declaration was documented as fixing problems on NetBSD and then
OpenBSD. If it's true as per the libpq comment that only FreeBSD needs
the client-side cmsgmem buffer, this might not have gotten retested.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Greg Sabino Mullane 2011-05-30 15:26:29 Re: Failed pgbench: setrandom invalid maximum number 0
Previous Message Tom Lane 2011-05-29 18:08:33 Re: [PATCH] ident authentication fails on kFreeBSD/x86-64 due to wrong struct size