Thread: postmaster segfaults when pg_hba.cof is missing

postmaster segfaults when pg_hba.cof is missing

From
Rudy Lippan
Date:
============================================================================
                        POSTGRESQL BUG REPORT TEMPLATE
============================================================================


Your name               : Rudy Lippan
Your email address      : rlippan@remotelinux.com


System Configuration
---------------------
  Architecture (example: Intel Pentium)         : PII-400x4

  Operating System (example: Linux 2.0.26 ELF)  : Linux 2.4.19-gentoo-r9

  PostgreSQL version (example: PostgreSQL-7.3):   PostgreSQL-7.3

  Compiler used (example:  gcc 2.95.2)          : 2.95.3


Please enter a FULL description of your problem:
------------------------------------------------

I know this is a broken install, but postmaster should not segfault when
it can't find a file.

postgres@war PGDATA $ ../pgsql7.3/bin/postmaster
LOG:  load_hba: Unable to open authentication config file
"/usr/local/PGDATA/pgsql7.3/pg_hba.conf": No such file or directory
Segmentation fault (core dumped)


Please describe a way to repeat the problem.   Please try to provide a
concise reproducible example, if at all possible:
----------------------------------------------------------------------

rm pg_hba.conf


If you know how this problem might be fixed, list the solution below:
---------------------------------------------------------------------

Re: postmaster segfaults when pg_hba.cof is missing

From
Neil Conway
Date:
On Thu, 2002-12-12 at 13:13, Rudy Lippan wrote:
> I know this is a broken install, but postmaster should not segfault when
> it can't find a file.
>
> postgres@war PGDATA $ ../pgsql7.3/bin/postmaster
> LOG:  load_hba: Unable to open authentication config file
> "/usr/local/PGDATA/pgsql7.3/pg_hba.conf": No such file or directory
> Segmentation fault (core dumped)

Good catch. Here's a patch against CVS HEAD that fixes the problem.

The actual segfault was caused by a double pfree(), but ISTM that
failing to find pg_hba.conf should be a fatal error anyway, so I
increased the priority of the elog() from LOG to FATAL and refactored
the code a little bit.

Bruce: unless anyone has an objection, please apply.

Thanks for the report.

Cheers,

Neil

Attachment

Re: postmaster segfaults when pg_hba.cof is missing

From
Bruce Momjian
Date:
[ Will be backpatched.]

Your patch has been added to the PostgreSQL unapplied patches list at:

    http://momjian.postgresql.org/cgi-bin/pgpatches

I will try to apply it within the next 48 hours.

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


Neil Conway wrote:
> On Thu, 2002-12-12 at 13:13, Rudy Lippan wrote:
> > I know this is a broken install, but postmaster should not segfault when
> > it can't find a file.
> >
> > postgres@war PGDATA $ ../pgsql7.3/bin/postmaster
> > LOG:  load_hba: Unable to open authentication config file
> > "/usr/local/PGDATA/pgsql7.3/pg_hba.conf": No such file or directory
> > Segmentation fault (core dumped)
>
> Good catch. Here's a patch against CVS HEAD that fixes the problem.
>
> The actual segfault was caused by a double pfree(), but ISTM that
> failing to find pg_hba.conf should be a fatal error anyway, so I
> increased the priority of the elog() from LOG to FATAL and refactored
> the code a little bit.
>
> Bruce: unless anyone has an objection, please apply.
>
> Thanks for the report.
>
> Cheers,
>
> Neil

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: postmaster segfaults when pg_hba.cof is missing

From
Bruce Momjian
Date:
Patch applied to HEAD and 7.3.X.  Thanks.

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



Neil Conway wrote:
> On Thu, 2002-12-12 at 13:13, Rudy Lippan wrote:
> > I know this is a broken install, but postmaster should not segfault when
> > it can't find a file.
> >
> > postgres@war PGDATA $ ../pgsql7.3/bin/postmaster
> > LOG:  load_hba: Unable to open authentication config file
> > "/usr/local/PGDATA/pgsql7.3/pg_hba.conf": No such file or directory
> > Segmentation fault (core dumped)
>
> Good catch. Here's a patch against CVS HEAD that fixes the problem.
>
> The actual segfault was caused by a double pfree(), but ISTM that
> failing to find pg_hba.conf should be a fatal error anyway, so I
> increased the priority of the elog() from LOG to FATAL and refactored
> the code a little bit.
>
> Bruce: unless anyone has an objection, please apply.
>
> Thanks for the report.
>
> Cheers,
>
> Neil

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073