]> granicus.if.org Git - postgresql/commit
Repair failure to check that a table is still compatible with a previously
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 2 Feb 2007 00:08:01 +0000 (00:08 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 2 Feb 2007 00:08:01 +0000 (00:08 +0000)
commit7fbfa4e96a3fc2012bbdb394a2b7ada846770ce3
tree4e49fa7deffa4d2839ec3d5715ac0890f62be5f3
parentf67497141888dfeea36401ba2a93d9bd74a6ecd7
Repair failure to check that a table is still compatible with a previously
made query plan.  Use of ALTER COLUMN TYPE creates a hazard for cached
query plans: they could contain Vars that claim a column has a different
type than it now has.  Fix this by checking during plan startup that Vars
at relation scan level match the current relation tuple descriptor.  Since
at that point we already have at least AccessShareLock, we can be sure the
column type will not change underneath us later in the query.  However,
since a backend's locks do not conflict against itself, there is still a
hole for an attacker to exploit: he could try to execute ALTER COLUMN TYPE
while a query is in progress in the current backend.  Seal that hole by
rejecting ALTER TABLE whenever the target relation is already open in
the current backend.

This is a significant security hole: not only can one trivially crash the
backend, but with appropriate misuse of pass-by-reference datatypes it is
possible to read out arbitrary locations in the server process's memory,
which could allow retrieving database content the user should not be able
to see.  Our thanks to Jeff Trout for the initial report.

Security: CVE-2007-0556
src/backend/commands/tablecmds.c
src/backend/executor/execQual.c
src/backend/executor/execScan.c