Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YNTGM-0004Fz-2x for pgsql-bugs@arkaria.postgresql.org; Mon, 16 Feb 2015 21:31:30 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YNTGL-0004Hk-J7 for pgsql-bugs@arkaria.postgresql.org; Mon, 16 Feb 2015 21:31:29 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YNTGK-0004He-HS for pgsql-bugs@postgresql.org; Mon, 16 Feb 2015 21:31:28 +0000 Received: from [2607:f2f8:a520::2] (helo=elysion.barrera.io) by magus.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YNTGE-0001p1-MO for pgsql-bugs@postgresql.org; Mon, 16 Feb 2015 21:31:26 +0000 Received: from elysion.barrera.io (localhost [127.0.0.1]); by elysion.barrera.io (OpenSMTPD) with ESMTP id bdc9dc02; for ; Mon, 16 Feb 2015 21:31:12 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=barrera.io; h=date:from:to :subject:message-id:references:mime-version:content-type :in-reply-to; s=elysion; bh=oSqBSS7pFUIXvF8l8+kB/QXuhZY=; b=Ah3G Ja4DhAaX9N3sFDhId0HeIsse7YvvAKH0Qc6BA03aIxdeuu2kEwIZ/jXhlst4OXrd HSp9JUHfDIelMERdR60NahteT5h7eKGlLKy5LJtJQ6X+b4Ibnq1kPDjnJeTulFke YO3O8BqjcJG8RX+zlPmzG9O/5nt2z83LXsICjdlvx4Uz6N+tuPLNoN10yBsS7QVA YQXXFEDxPhtBuusBHcgqyw7Mn1vEdZn4SM16P2JGHSsNo18yPn4CzMsdHghY4xJi xlpppJfDWnY+Czj3MLAobkpyuKxseymfITSqGLI9Bi2PtmZOi2rLbiPZ/lZB2zVH /njLrkJSl5bp1sjACQ== DomainKey-Signature: a=rsa-sha1; c=nofws; d=barrera.io; h=date:from:to :subject:message-id:references:mime-version:content-type :in-reply-to; q=dns; s=elysion; b=ZPv+Rc1tNq88mljBRr3shTE4kyZdUL xEq7UEAqtd6t4EOfoJ2iWbb5AMSqdLKyLS9u3BnfsclJ0O3T0k6oG0txed/cL4oH vx8IH5MHc5ZSIa4EluetcC8dwQ1RQuoO67ecm4VHcT58OGiOL2WQzEI+Pv7RBHJe M3+QaVSkIy2ydo8oC/PacEo1pxvPwvX0FGlJCovB0Sh8oT7oKHloHcu08X1kZSyD S8paQg6enbFAmkfM8Bd81/CnGEVNOyBq1bREbkNCTkhfhFVJ6KvC3CE33e+9KO4U w6rh7QDpAvA6EzjltPy1pfE+FJhI7NkhFE6nHONxAvhXnHQ8YlKfStoA== Received: from athena.barrera.io (2800:40:7aa:1:bae8:56ff:fe18:7bf6 [IPv6:2800:40:7aa:1:bae8:56ff:fe18:7bf6]); by smtp.barrera.io (OpenSMTPD) with ESMTPSA id 2e6284df; TLS version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO; for ; Mon, 16 Feb 2015 21:31:12 +0000 (GMT) Received: from athena.barrera.io (localhost [IPv6:::1]); by athena.barrera.io (OpenSMTPD) with ESMTP id d3c122e3; for ; Mon, 16 Feb 2015 21:31:30 +0000 (UTC) Date: Mon, 16 Feb 2015 18:31:30 -0300 From: Hugo Osvaldo Barrera To: pgsql-bugs@postgresql.org Subject: Re: postgresql-server exiting abnormally after an OS upgrade Message-ID: <20150216213130.GA28835@athena.barrera.io> References: <20150212224257.GA16161@athena.barrera.io> <54DDFC33.6090703@vmware.com> <20150216202138.GB20474@athena.barrera.io> <16513.1424120138@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="k1lZvvs/B4yU6o8G" Content-Disposition: inline In-Reply-To: <16513.1424120138@sss.pgh.pa.us> User-Agent: Mutt/1.5.23.1-rc1 (2014-03-12) X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f2f8:a520::2 (deferred) X-Pg-Spam-Score: -1.2 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org --k1lZvvs/B4yU6o8G Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2015-02-16 15:55, Tom Lane wrote: > Hugo Osvaldo Barrera writes: > > On 2015-02-13 15:29, Heikki Linnakangas wrote: > >> Can you get a core dump and a stack trace from it? >=20 > > It certainly took me a bit, but, with some help, I managed to get one: >=20 > > (gdb) bt > > #0 0x0000110a2815b92a in kill () at :2 > > #1 0x0000110a28195119 in abort () at /usr/src/lib/libc/stdlib/abort.= c:53 > > #2 0x0000110a2816a238 in memcpy (dst0=3D0xfb8d4, src0=3D0x6, length= =3D0) at /usr/src/lib/libc/string/memcpy.c:65 > > #3 0x000011080cf8d1b1 in check_ip (raddr=3D0x110a899f7918, addr=3D0x= 110a899f9058, mask=3D0x110a899f9158) at hba.c:704 > > #4 0x000011080cf90a04 in check_hba (port=3D0x110a899f7800) at hba.c:= 1718 >=20 > Huh. You didn't say whether this is 9.3 or 9.4, but it doesn't matter > because that code is the same in both; the crash is happening here: >=20 It's 9.4, the issue appeared after an OS upgrade which was accompanied by an upgrade to 9.3 I *did* try to downgrade back to 9.3 at that point, but got = the same issue. > static bool > check_ip(SockAddr *raddr, struct sockaddr * addr, struct sockaddr * mask) > { > ... > /* > * If we're connected on IPv6 but the file specifies an IPv4 addr= ess > * to match against, promote the latter to an IPv6 address before > * trying to match the client's address. > */ > struct sockaddr_storage addrcopy, > maskcopy; >=20 > memcpy(&addrcopy, &addr, sizeof(addrcopy)); > ---> memcpy(&maskcopy, &mask, sizeof(maskcopy)); >=20 > Looking at this, the code seems wrong on its face: the memcpy sources > should be "addr" and "mask", not "&addr" and "&mask". Apparently, no one > has ever used or tested this case since it was put in :-(. I find that > a bit astonishing given the steady creep of IPv6 support, but it's hard > to see how the code could possibly work correctly as-is. >=20 > Probably the reason why this was triggered by an OS upgrade is that your > system is now choosing to make the DB connection over IPv6 not IPv4. > Or maybe it was doing that right along but you now have a memcpy that is > doing more checking of its arguments than before (this is evidently an > argument sanity check and not a straight SIGSEGV). >=20 My host has been configured to use IPv6 by default for some time now, but it *is* possible that there has been some OS-level change during this upgrade = that affected this in some way. > Anyway you could work around it for now by being sure to list IPv6 > equivalent addresses before IPv4 addresses in your pg_hba.conf. > We'll fix it properly in the next releases. >=20 Do you mean IPv6 *before* IPv4? Wouldn't that add a preference to IPv6? I currently have the stock out-of-the-box pg_hba: # TYPE DATABASE USER ADDRESS METHOD # "local" is for Unix domain socket connections only local all all md5 # IPv4 local connections: host all all 127.0.0.1/32 md5 # IPv6 local connections: host all all ::1/128 md5 (I deleted commented out lines for readability). > regards, tom lane >=20 Thanks, --=20 Hugo Osvaldo Barrera A: Because we read from top to bottom, left to right. Q: Why should I start my reply below the quoted text? --k1lZvvs/B4yU6o8G Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAABCAAGBQJU4mGxAAoJEG+f/xIrmMDNZ58P/RHs1EKafpPerH2Wq/Y9BLxC S/ylszU9riNhybLYPV5DA4Evu5Cz7ywy44qrIOsHq/Zf2r0Me71ISlNeLdU4I2Gh ddK9iiOho+8kRQy0j1lANdBy35j1P+ZWLrT++MDkQv6Vwe/UvYeOOqzl5pHpdw6+ vGmGro0p0UHHzaf5eFmVlMXi2QuvUj+/bWo0cJ383moogHvyAJsbn8PojKJZr5iJ TgrK29tTQfxLekhFby//5IYXK6kJf4P591xAwHwpnCm3ffY+wBKy/GuiD1bhs6/a Qz/AuNYHauHSp9Sraxu7K/x0i4ZOqNmM0eiKqoC/JEFIiZYfYTd7HxK2eZNg0NFZ NkTJpFrSPh784awHKWWw6pn418R78t8Hxs7iheJ7OGe1I+C6Z1XgunUq5/xLhbkA Ce5QpvIqLQvj/3ahEfYpC4kBecKJJLSLfDeDbqoMMK6p8cFARksdLlogibYKa7eG rsA62cjEURofxnGTOcd65/X1nMHuIF64JVAWAZsZTDgVnbozfgVHYVgYnlZvHCX3 04ajotGWub25j/AJvGLSMx0aZSQZhAjs+bhCkh4SM2iqdzXsTqAid2X4R8zRHYcw RpTZvDHykxQVjI8kn9xaWQbrrrb1UYrC5FIkED2BBQStyCurS07dAQuxSVbH9lPv /ZD0Z8MVrS5TwpNko6c4 =HbYU -----END PGP SIGNATURE----- --k1lZvvs/B4yU6o8G--