~ubuntu-branches/ubuntu/oneiric/postgresql-9.1/oneiric-security

« back to all changes in this revision

Viewing changes to src/backend/access/transam/xact.c

  • Committer: Package Import Robot
  • Author(s): Martin Pitt
  • Date: 2013-02-05 18:13:52 UTC
  • mfrom: (1.1.10) (10.1.5 oneiric-proposed)
  • Revision ID: package-import@ubuntu.com-20130205181352-3kw4f94ilqklzm7c
Tags: 9.1.8-0ubuntu11.10
* New upstream security/bug fix release: (LP: #1116336)
  - Prevent execution of enum_recv from SQL
    The function was misdeclared, allowing a simple SQL command to crash the
    server.  In principle an attacker might be able to use it to examine the
    contents of server memory.  Our thanks to Sumit Soni (via Secunia SVCRP)
    for reporting this issue. (CVE-2013-0255)
  - See HISTORY/changelog.gz for the other bug fixes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1917
1917
        AtEOXact_SPI(true);
1918
1918
        AtEOXact_on_commit_actions(true);
1919
1919
        AtEOXact_Namespace(true);
1920
 
        /* smgrcommit already done */
 
1920
        AtEOXact_SMgr();
1921
1921
        AtEOXact_Files();
1922
1922
        AtEOXact_ComboCid();
1923
1923
        AtEOXact_HashTables(true);
2163
2163
        AtEOXact_SPI(true);
2164
2164
        AtEOXact_on_commit_actions(true);
2165
2165
        AtEOXact_Namespace(true);
2166
 
        /* smgrcommit already done */
 
2166
        AtEOXact_SMgr();
2167
2167
        AtEOXact_Files();
2168
2168
        AtEOXact_ComboCid();
2169
2169
        AtEOXact_HashTables(true);
2309
2309
                AtEOXact_SPI(false);
2310
2310
                AtEOXact_on_commit_actions(false);
2311
2311
                AtEOXact_Namespace(false);
 
2312
                AtEOXact_SMgr();
2312
2313
                AtEOXact_Files();
2313
2314
                AtEOXact_ComboCid();
2314
2315
                AtEOXact_HashTables(false);
4543
4544
        }
4544
4545
 
4545
4546
        /* Make sure files supposed to be dropped are dropped */
4546
 
        for (i = 0; i < xlrec->nrels; i++)
 
4547
        if (xlrec->nrels > 0)
4547
4548
        {
4548
 
                SMgrRelation srel = smgropen(xlrec->xnodes[i], InvalidBackendId);
4549
 
                ForkNumber      fork;
 
4549
                /*
 
4550
                 * First update minimum recovery point to cover this WAL record. Once
 
4551
                 * a relation is deleted, there's no going back. The buffer manager
 
4552
                 * enforces the WAL-first rule for normal updates to relation files,
 
4553
                 * so that the minimum recovery point is always updated before the
 
4554
                 * corresponding change in the data file is flushed to disk, but we
 
4555
                 * have to do the same here since we're bypassing the buffer manager.
 
4556
                 *
 
4557
                 * Doing this before deleting the files means that if a deletion fails
 
4558
                 * for some reason, you cannot start up the system even after restart,
 
4559
                 * until you fix the underlying situation so that the deletion will
 
4560
                 * succeed. Alternatively, we could update the minimum recovery point
 
4561
                 * after deletion, but that would leave a small window where the
 
4562
                 * WAL-first rule would be violated.
 
4563
                 */
 
4564
                XLogFlush(lsn);
4550
4565
 
4551
 
                for (fork = 0; fork <= MAX_FORKNUM; fork++)
 
4566
                for (i = 0; i < xlrec->nrels; i++)
4552
4567
                {
4553
 
                        XLogDropRelation(xlrec->xnodes[i], fork);
4554
 
                        smgrdounlink(srel, fork, true);
 
4568
                        SMgrRelation srel = smgropen(xlrec->xnodes[i], InvalidBackendId);
 
4569
                        ForkNumber      fork;
 
4570
 
 
4571
                        for (fork = 0; fork <= MAX_FORKNUM; fork++)
 
4572
                        {
 
4573
                                XLogDropRelation(xlrec->xnodes[i], fork);
 
4574
                                smgrdounlink(srel, fork, true);
 
4575
                        }
 
4576
                        smgrclose(srel);
4555
4577
                }
4556
 
                smgrclose(srel);
4557
4578
        }
4558
4579
 
4559
4580
        /*
4560
4581
         * We issue an XLogFlush() for the same reason we emit ForceSyncCommit()
4561
 
         * in normal operation. For example, in DROP DATABASE, we delete all the
4562
 
         * files belonging to the database, and then commit the transaction. If we
4563
 
         * crash after all the files have been deleted but before the commit, you
4564
 
         * have an entry in pg_database without any files. To minimize the window
 
4582
         * in normal operation. For example, in CREATE DATABASE, we copy all files
 
4583
         * from the template database, and then commit the transaction. If we
 
4584
         * crash after all the files have been copied but before the commit, you
 
4585
         * have files in the data directory without an entry in pg_database. To
 
4586
         * minimize the window
4565
4587
         * for that, we use ForceSyncCommit() to rush the commit record to disk as
4566
4588
         * quick as possible. We have the same window during recovery, and forcing
4567
4589
         * an XLogFlush() (which updates minRecoveryPoint during recovery) helps