Re: BUG #3902: Segmentation faults using GSSAPI authentication

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Peter Koczan" <pjkoczan(at)gmail(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #3902: Segmentation faults using GSSAPI authentication
Date: 2008-01-30 04:17:39
Message-ID: 2096.1201666659@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"Peter Koczan" <pjkoczan(at)gmail(dot)com> writes:
> Program received signal SIGSEGV, Segmentation fault.
> 0x0056bfde in getenv () from /lib/libc.so.6
> (gdb) bt
> #0 0x0056bfde in getenv () from /lib/libc.so.6
> #1 0x005c1490 in tzset_internal () from /lib/libc.so.6
> #2 0x005c1fad in tzset () from /lib/libc.so.6
> #3 0x005c6726 in strftime_l () from /lib/libc.so.6
> #4 0x0060b67f in __vsyslog_chk () from /lib/libc.so.6
> #5 0x0060bbaa in syslog () from /lib/libc.so.6
> #6 0x0830e3f9 in write_syslog ()
> #7 0x0830f7a8 in send_message_to_server_log ()
> #8 0x0830daf4 in EmitErrorReport ()
> #9 0x082450bd in PostgresMain ()
> #10 0x08210b9e in BackendRun ()
> #11 0x08210174 in BackendStartup ()
> #12 0x0820dc53 in ServerLoop ()
> #13 0x0820d631 in PostmasterMain ()
> #14 0x081b2ee7 in main ()

Hmm, crash inside getenv?? That's weird, that suggests something has
clobbered the environment-strings data structure.

[ pokes around in code... ] And behold, here's a smoking gun:
pg_GSS_recvauth() is doing a putenv() with a string that it got from
palloc(). The active context at this point is PostmasterContext,
which *is* going to go away soon, leaving a gaping hole in the environ
list.

I still couldn't reproduce a crash with that knowledge, but I bet that
if you apply the attached patch, things will get better.

regards, tom lane

Attachment Content-Type Size
unknown_filename text/plain 1.3 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Rupinder 2008-01-30 07:55:45 BUG #3912: PGADMIN3 closes abrubptly
Previous Message Tom Lane 2008-01-29 23:00:25 Re: BUG #3911: can not 'make'