pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Hugo Osvaldo Barrera <hugo@barrera.io>
To: pgsql-bugs@postgresql.org
Subject: Fwd: Re: postgresql-server exiting abnormally after upgrade to -snapshot
Date: Tue, 17 Feb 2015 11:38:46 -0300
Message-ID: <20150217143846.GA25948@athena.barrera.io> (raw)
In-Reply-To: <22592.1424133497@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

Hi,

This comes as a follow-up on a recent issue I mentioned and was discussed on
this list. (See thread [1]).

The included patch fixes the issue and postgres has been working fine for me
with it. See this thread[2] for details.

Cheers,

----- Forwarded message from Jérémie Courrèges-Anglas <jca@wxcvbn.org> -----

> Date: Mon, 16 Feb 2015 23:21:05 +0100
> From: Jérémie Courrèges-Anglas <jca@wxcvbn.org>
> Subject: Re: postgresql-server exiting abnormally after upgrade to -snapshot
> To: Hugo Osvaldo Barrera <hugo@barrera.io>
> Cc: misc@openbsd.org
> Mail-Followup-To: Hugo Osvaldo Barrera <hugo@barrera.io>, misc@openbsd.org
> 
> jca@wxcvbn.org (Jérémie Courrèges-Anglas) writes:
> 
> > Please try the diff below.  It fixes the "backwards memcpy" problem
> > easily noticeable with psql -h ::1.
> 
> Updated diff. Thanks to Stuart for reminding me that netmasks sa_len
> values can be much surprising.
> 
> $OpenBSD$
> --- src/backend/libpq/hba.c.orig	Mon Feb 16 21:53:21 2015
> +++ src/backend/libpq/hba.c	Mon Feb 16 23:08:38 2015
> @@ -700,8 +700,13 @@ check_ip(SockAddr *raddr, struct sockaddr * addr, stru
>  		struct sockaddr_storage addrcopy,
>  					maskcopy;
>  
> -		memcpy(&addrcopy, &addr, sizeof(addrcopy));
> -		memcpy(&maskcopy, &mask, sizeof(maskcopy));
> +		memcpy(&addrcopy, addr, sizeof(struct sockaddr_in));
> +		/*
> +		 * On some OSes, if mask is obtained from eg. getifaddrs(3), sa_len
> +		 * can vary wildly. We already know that addr->sa_family == AF_INET,
> +		 * so just use sizeof(struct sockaddr_in).
> +		 */
> +		memcpy(&maskcopy, mask, sizeof(struct sockaddr_in));
>  		pg_promote_v4_to_v6_addr(&addrcopy);
>  		pg_promote_v4_to_v6_mask(&maskcopy);
>  
> 
> 
> -- 
> jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE
> 

----- End forwarded message -----

[1]: http://www.postgresql.org/message-id/20150216202138.GB20474@athena.barrera.io
[2]: https://marc.info/?t=142367714200001&r=1&w=2

-- 
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?

Attachments:

  signature.asc (application/pgp-signature, 818B) download

view thread (8+ messages)  latest in thread

Message-ID: <20150217143846.GA25948@athena.barrera.io>
Permalink:  ../20150217143846.GA25948@athena.barrera.io/
Also on:    postgresql.org/message-id/20150217143846.GA25948@athena.barrera.io

 · 

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: hugo@barrera.io
  Subject: Re: Fwd: Re: postgresql-server exiting abnormally after upgrade to -snapshot
  In-Reply-To: <20150217143846.GA25948@athena.barrera.io>
  References: <22592.1424133497@sss.pgh.pa.us> <20150217143846.GA25948@athena.barrera.io>

* 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