Re: [PORTS] Bug Report with Postgres 7.4 on AIX 5.3

From: "Mohan, Ross" <RMohan(at)arbinet(dot)com>
To: <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: [PORTS] Bug Report with Postgres 7.4 on AIX 5.3
Date: 2005-05-19 00:22:33
Message-ID: CC74E7E10A8A054798B6611BD1FEF4D30625DAE5@vamail01.thexchange.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-ports

Vincent,

1) I am having the exact same problem: I cannot even do a CREATEDB in 8.0.2 on AIX5.3

2) You sent your mail to the PG lists, but not to IBM, possibly?

3) If you think it will help, I can call support as well.

If you get ANY word on this, whether a fix, a tweak, or a workaround, please Please PLEASE
post to the list rapidly.

We're dead in the water on this and the IT environment around here is such that if I can't
get PG working on AIX, it'll be marked for death. And I really wanted to start
using PG around here.

Thanks!!!!!

-- Ross Mohan

-----Original Message-----
From: pgsql-ports-owner(at)postgresql(dot)org [mailto:pgsql-ports-owner(at)postgresql(dot)org] On Behalf Of Vincent Vanwynsberghe
Sent: Tuesday, May 10, 2005 4:08 AM
To: pgsql-ports(at)postgresql(dot)org; pgsql-bugs(at)postgresql(dot)org
Subject: [PORTS] Bug Report with Postgres 7.4 on AIX 5.3

Dear Support,

We try to install Postgres 7.4 on AIX 5.3 (IBM,9111-520).
The compilation is good and we are able to start the postmaster. When we try to start the psql we got the following error :
FATAL: unsupported frontend protocol 0.0: server supports 1.0 to 3.0

We run the psql under the AIX debugger dbx and our conclusions are the following :

In the file fe-connect.c we try to copy a area of 1025 in the
conn->raddr.addr area but the size of that area is only 144.
The result is a corruption of the pg_conn structure

+1175 /* Remember current address
for possible error msg */
+1176 memcpy(&conn->raddr.addr,
addr_cur->ai_addr,
+1177
addr_cur->ai_addrlen);

The addr_cur->ai_addrlen is set with the sizeof(struct sockaddr_un) in the file ip.c.

In the file libpq-int.h the structure pg_conn contains 2 fields SockAddr
* PGconn stores all the state data associated with a single connection
* to a backend.
*/
struct pg_conn
{
...
SockAddr laddr; /* Local address */
SockAddr raddr;
...
}

The structure SockAddr is defined in the file pqcomm.h

typedef struct
{
struct sockaddr_storage addr;
ACCEPT_TYPE_ARG3 salen;
} SockAddr;

On Our AIX 5.3 the sockaddr_un is defined in the file /usr/include/sys/un.h

#if defined(COMPAT_43) && !defined(_KERNEL)
struct sockaddr_un {
ushort_t sun_family; /* AF_UNIX */
char sun_path[PATH_MAX]; /* changed from 104 to PATH_MAX to
support long user names */
};
#else
struct sockaddr_un {
uchar_t sun_len; /* sockaddr len including null */
sa_family_t sun_family; /* AF_UNIX */
char sun_path[PATH_MAX]; /* changed from 104 to PATH_MAX to
support long user names */
};
#endif /* COMPAT_43 && !_KERNEL */

PATH_MAX is defined in the file /usr/include/sys/limits.h

#if _POSIX_C_SOURCE >= 200112L && !(defined _ALL_SOURCE) ||
defined(_PATHMAX_HAS_NULL)
#define PATH_MAX 1024 /* max number of bytes in a
pathname.
includes a terminating null */ #else
#define PATH_MAX 1023
#endif

In our platform the sizeof of struct sockaddr_un is 1025 and the sizeof of SockAddr is 144. In conclusion the instructions done in the function PQconnectPoll cause a memory overflow !!!

+1175 /* Remember current address
for possible error msg */
+1176 memcpy(&conn->raddr.addr,
addr_cur->ai_addr,
+1177
addr_cur->ai_addrlen);

Are you aware about this problem ?
Could you give us a way to solve the problem ?

Kind Regards,
Vincent Vanwynsberghe

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Neil Conway 2005-05-19 01:55:32 Re: BUG #1671: Long interval string representation rejected
Previous Message Tom Lane 2005-05-18 21:26:35 Re: BUG #1672: Postgres 8.0 doesn't return errors.

Browse pgsql-ports by date

  From Date Subject
Next Message Vincent Vanwynsberghe 2005-05-19 08:49:14 Re: [PORTS] Bug Report with Postgres 7.4 on AIX 5.3
Previous Message Andrew - Supernews 2005-05-11 20:27:12 Re: Bug Report with Postgres 7.4 on AIX 5.3