Re: GSSAPI on Solaris - psql segfault

Lists: pgsql-hackers
From: Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: GSSAPI on Solaris - psql segfault
Date: 2007-07-13 16:06:27
Message-ID: 4697A303.2070700@kaltenbrunner.cc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

I just took a look at adding gssapi build support on solaris (solaris
10/x86_64, sun studio 10, 64bit build) which seemed easy enough by
educating configure to look for -lgss but while it compiles just fine
the resulting tree will not be able to complete a make check due to
psql(!) segfaulting as soon as it tries to connect to the backend.

the backtrace looks similiar to:

program terminated by signal SEGV (no mapping at the fault address)
0x00007fffffd3d401: _memcpy+0x00e1: movq %rax,(%rdi)
Current function is pqPutMsgBytes
475 memcpy(conn->outBuffer + conn->outMsgEnd, buf, len);
(dbx) where
[1] _memcpy(0x4, 0x4709a0, 0x67, 0x2, 0x646c697562677000,
0x7361626174616400), at 0x7fffffd3d401
=>[2] pqPutMsgBytes(buf = 0x4709a0, len = 103U, conn = 0x4682f0), line
475 in "fe-misc.c"
[3] pqPutnchar(s = 0x4709a0 "", len = 103U, conn = 0x4682f0), line 189
in "fe-misc.c"
[4] pqPacketSend(conn = 0x4682f0, pack_type = '\0', buf = 0x4709a0,
buf_len = 103U), line 2439 in "fe-connect.c"
[5] PQconnectPoll(conn = 0x4682f0), line 1299 in "fe-connect.c"
[6] connectDBComplete(conn = 0x4682f0), line 936 in "fe-connect.c"
[7] PQsetdbLogin(pghost = (nil), pgport = (nil), pgoptions = (nil),
pgtty = (nil), dbName = 0xfffffd7fffdffbeb "postgres", login = (nil),
pwd = (nil)), line 660 in "fe-connect.c"
[8] main(argc = 3, argv = 0xfffffd7fffdff9b8), line 211 in "startup.c"

ideas ?

Stefan


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: GSSAPI on Solaris - psql segfault
Date: 2007-07-13 17:44:17
Message-ID: 200707131744.l6DHiHG03317@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Stefan Kaltenbrunner wrote:
> I just took a look at adding gssapi build support on solaris (solaris
> 10/x86_64, sun studio 10, 64bit build) which seemed easy enough by
> educating configure to look for -lgss but while it compiles just fine
> the resulting tree will not be able to complete a make check due to
> psql(!) segfaulting as soon as it tries to connect to the backend.

Can we add the segfault to the Solaris expected regression results? ;-)

---------------------------------------------------------------------------

>
> the backtrace looks similiar to:
>
>
> program terminated by signal SEGV (no mapping at the fault address)
> 0x00007fffffd3d401: _memcpy+0x00e1: movq %rax,(%rdi)
> Current function is pqPutMsgBytes
> 475 memcpy(conn->outBuffer + conn->outMsgEnd, buf, len);
> (dbx) where
> [1] _memcpy(0x4, 0x4709a0, 0x67, 0x2, 0x646c697562677000,
> 0x7361626174616400), at 0x7fffffd3d401
> =>[2] pqPutMsgBytes(buf = 0x4709a0, len = 103U, conn = 0x4682f0), line
> 475 in "fe-misc.c"
> [3] pqPutnchar(s = 0x4709a0 "", len = 103U, conn = 0x4682f0), line 189
> in "fe-misc.c"
> [4] pqPacketSend(conn = 0x4682f0, pack_type = '\0', buf = 0x4709a0,
> buf_len = 103U), line 2439 in "fe-connect.c"
> [5] PQconnectPoll(conn = 0x4682f0), line 1299 in "fe-connect.c"
> [6] connectDBComplete(conn = 0x4682f0), line 936 in "fe-connect.c"
> [7] PQsetdbLogin(pghost = (nil), pgport = (nil), pgoptions = (nil),
> pgtty = (nil), dbName = 0xfffffd7fffdffbeb "postgres", login = (nil),
> pwd = (nil)), line 660 in "fe-connect.c"
> [8] main(argc = 3, argv = 0xfffffd7fffdff9b8), line 211 in "startup.c"
>
>
> ideas ?
>
>
> Stefan
>
> ---------------------------(end of broadcast)---------------------------
> TIP 7: You can help support the PostgreSQL project by donating at
>
> http://www.postgresql.org/about/donate

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +


From: Zdenek Kotala <Zdenek(dot)Kotala(at)Sun(dot)COM>
To: Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: GSSAPI on Solaris - psql segfault
Date: 2007-07-13 20:24:43
Message-ID: 4697DF8B.6020704@sun.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Stefan Kaltenbrunner wrote:
> I just took a look at adding gssapi build support on solaris (solaris
> 10/x86_64, sun studio 10, 64bit build) which seemed easy enough by
> educating configure to look for -lgss but while it compiles just fine
> the resulting tree will not be able to complete a make check due to
> psql(!) segfaulting as soon as it tries to connect to the backend.
> the backtrace looks similiar to:
>
>
> program terminated by signal SEGV (no mapping at the fault address)
> 0x00007fffffd3d401: _memcpy+0x00e1: movq %rax,(%rdi)
> Current function is pqPutMsgBytes
> 475 memcpy(conn->outBuffer + conn->outMsgEnd, buf, len);
> (dbx) where
> [1] _memcpy(0x4, 0x4709a0, 0x67, 0x2, 0x646c697562677000,
> 0x7361626174616400), at 0x7fffffd3d401
> =>[2] pqPutMsgBytes(buf = 0x4709a0, len = 103U, conn = 0x4682f0), line
> 475 in "fe-misc.c"
> [3] pqPutnchar(s = 0x4709a0 "", len = 103U, conn = 0x4682f0), line 189
> in "fe-misc.c"
> [4] pqPacketSend(conn = 0x4682f0, pack_type = '\0', buf = 0x4709a0,
> buf_len = 103U), line 2439 in "fe-connect.c"
> [5] PQconnectPoll(conn = 0x4682f0), line 1299 in "fe-connect.c"
> [6] connectDBComplete(conn = 0x4682f0), line 936 in "fe-connect.c"
> [7] PQsetdbLogin(pghost = (nil), pgport = (nil), pgoptions = (nil),
> pgtty = (nil), dbName = 0xfffffd7fffdffbeb "postgres", login = (nil),
> pwd = (nil)), line 660 in "fe-connect.c"
> [8] main(argc = 3, argv = 0xfffffd7fffdff9b8), line 211 in "startup.c"
>
>
> ideas ?

Do you use also 64bit psql? Can you send me your ./configure setup?
However, I see there potential integer overflow, because len is size_t
and conn->outMsgEnd is defined as int.

Zdenek


From: Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>
To: Zdenek Kotala <Zdenek(dot)Kotala(at)Sun(dot)COM>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: GSSAPI on Solaris - psql segfault
Date: 2007-07-14 07:25:54
Message-ID: 46987A82.4010208@kaltenbrunner.cc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Zdenek Kotala wrote:
> Stefan Kaltenbrunner wrote:
>> I just took a look at adding gssapi build support on solaris (solaris
>> 10/x86_64, sun studio 10, 64bit build) which seemed easy enough by
>> educating configure to look for -lgss but while it compiles just fine
>> the resulting tree will not be able to complete a make check due to
>> psql(!) segfaulting as soon as it tries to connect to the backend.
>> the backtrace looks similiar to:
>>
>>
>> program terminated by signal SEGV (no mapping at the fault address)
>> 0x00007fffffd3d401: _memcpy+0x00e1: movq %rax,(%rdi)
>> Current function is pqPutMsgBytes
>> 475 memcpy(conn->outBuffer + conn->outMsgEnd, buf, len);
>> (dbx) where
>> [1] _memcpy(0x4, 0x4709a0, 0x67, 0x2, 0x646c697562677000,
>> 0x7361626174616400), at 0x7fffffd3d401
>> =>[2] pqPutMsgBytes(buf = 0x4709a0, len = 103U, conn = 0x4682f0), line
>> 475 in "fe-misc.c"
>> [3] pqPutnchar(s = 0x4709a0 "", len = 103U, conn = 0x4682f0), line 189
>> in "fe-misc.c"
>> [4] pqPacketSend(conn = 0x4682f0, pack_type = '\0', buf = 0x4709a0,
>> buf_len = 103U), line 2439 in "fe-connect.c"
>> [5] PQconnectPoll(conn = 0x4682f0), line 1299 in "fe-connect.c"
>> [6] connectDBComplete(conn = 0x4682f0), line 936 in "fe-connect.c"
>> [7] PQsetdbLogin(pghost = (nil), pgport = (nil), pgoptions = (nil),
>> pgtty = (nil), dbName = 0xfffffd7fffdffbeb "postgres", login = (nil),
>> pwd = (nil)), line 660 in "fe-connect.c"
>> [8] main(argc = 3, argv = 0xfffffd7fffdff9b8), line 211 in "startup.c"
>>
>>
>> ideas ?
>
> Do you use also 64bit psql? Can you send me your ./configure setup?
> However, I see there potential integer overflow, because len is size_t
> and conn->outMsgEnd is defined as int.

yeah this is a full 64bit build - but I just did several fresh buildfarm
cycles and I'm unable to reproduce the issue again ...

Stefan