pgsql: Fix cache flush hazard in cache_record_field_properties().

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix cache flush hazard in cache_record_field_properties().
Date: 2013-06-11 21:27:15
Message-ID: E1UmW5z-0004RK-Vr@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix cache flush hazard in cache_record_field_properties().

We need to increment the refcount on the composite type's cached tuple
descriptor while we do lookups of its column types. Otherwise a cache
flush could occur and release the tuple descriptor before we're done with
it. This fails reliably with -DCLOBBER_CACHE_ALWAYS, but the odds of a
failure in a production build seem rather low (since the pfree'd descriptor
typically wouldn't get scribbled on immediately). That may explain the
lack of any previous reports. Buildfarm issue noted by Christian Ullrich.

Back-patch to 9.1 where the bogus code was added.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/e262755bfc97f31442cc0def8098b1a7d2913355

Modified Files
--------------
src/backend/utils/cache/typcache.c | 5 +++++
1 file changed, 5 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2013-06-11 21:27:16 pgsql: Fix cache flush hazard in cache_record_field_properties().
Previous Message Tatsuo Ishii 2013-06-11 05:31:17 pgsql: Add description that loread()/lowrite() are corresponding to