pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: wurongxin@xmu.edu.cn
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #16070: A double-free bug in interfaces/libpq/fe-secure-openssl.c
Date: Mon, 21 Oct 2019 12:25:37 +0900
Message-ID: <20191021032537.GG1542@paquier.xyz> (raw)
In-Reply-To: <13213.1571581031@sss.pgh.pa.us>
References: <16070-ffac944519a43c3f@postgresql.org>
	<13213.1571581031@sss.pgh.pa.us>

On Sun, Oct 20, 2019 at 10:17:11AM -0400, Tom Lane wrote:
> I don't really believe this; if there were a double-free problem here,
> we'd surely have noticed it long since.

Yeah.

> Taking a look at the OpenSSL source code, it looks like engine_free_util
> decrements a reference count and doesn't actually delete anything until
> that's gone to zero.  So maybe the refcount is 2 at the beginning of
> this sequence?

The docs of OpenSSL mention the use of both successively, where
ENGINE_free() does the cleanup after ENGINE_by_id(), and
ENGINE_finish() cleans up after ENGINE_init():
https://www.openssl.org/docs/man1.1.0/man3/ENGINE_finish.html

And an actual issue is that we have no coverage for it:
https://coverage.postgresql.org/src/interfaces/libpq/fe-secure-openssl.c.gcov.html
--
Michael

Attachments:

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

view thread (4+ messages)  latest in thread

Message-ID: <20191021032537.GG1542@paquier.xyz>
Permalink:  ../20191021032537.GG1542@paquier.xyz/
Also on:    postgresql.org/message-id/20191021032537.GG1542@paquier.xyz

 · 

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: michael@paquier.xyz, tgl@sss.pgh.pa.us, wurongxin@xmu.edu.cn
  Subject: Re: BUG #16070: A double-free bug in interfaces/libpq/fe-secure-openssl.c
  In-Reply-To: <20191021032537.GG1542@paquier.xyz>
  References: <16070-ffac944519a43c3f@postgresql.org> <13213.1571581031@sss.pgh.pa.us> <20191021032537.GG1542@paquier.xyz>

* 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