pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix choice of comparison operators for cross-type hashed subplan
Date: Mon, 05 Aug 2019 15:20:57 +0000
Message-ID: <E1huenB-00079I-EX@gemulon.postgresql.org> (raw)

Fix choice of comparison operators for cross-type hashed subplans.

Commit bf6c614a2 rearranged the lookup of the comparison operators
needed in a hashed subplan, and in so doing, broke the cross-type
case: it caused the original LHS-vs-RHS operator to be used to compare
hash table entries too (which of course are all of the RHS type).
This leads to C functions being passed a Datum that is not of the
type they expect, with the usual hazards of crashes and unauthorized
server memory disclosure.

For the set of hashable cross-type operators present in v11 core
Postgres, this bug is nearly harmless on 64-bit machines, which
may explain why it escaped earlier detection.  But it is a live
security hazard on 32-bit machines; and of course there may be
extensions that add more hashable cross-type operators, which
would increase the risk.

Reported by Andreas Seltenreich.  Back-patch to v11 where the
problem came in.

Security: CVE-2019-10209

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/4766dce0dd1a1a26db253dfc81773a2c55cd2555

Modified Files
--------------
src/backend/executor/nodeSubplan.c      | 15 ++++++++++-----
src/test/regress/expected/subselect.out | 24 ++++++++++++++++++++++++
src/test/regress/sql/subselect.sql      | 10 ++++++++++
3 files changed, 44 insertions(+), 5 deletions(-)



view thread (3+ messages)  latest in thread

Message-ID: <E1huenB-00079I-EX@gemulon.postgresql.org>
Permalink:  ../E1huenB-00079I-EX@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1huenB-00079I-EX@gemulon.postgresql.org

 · 

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-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Fix choice of comparison operators for cross-type hashed subplan
  In-Reply-To: <E1huenB-00079I-EX@gemulon.postgresql.org>
  References: <E1huenB-00079I-EX@gemulon.postgresql.org>

* 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