Skip to content
Snippets Groups Projects
  1. Jan 03, 2008
    • Tom Lane's avatar
      Stamp release 8.3RC1. · 2bf121e4
      Tom Lane authored
      Security: CVE-2007-4769, CVE-2007-4772, CVE-2007-6067, CVE-2007-6600, CVE-2007-6601
    • Tom Lane's avatar
      Make standard maintenance operations (including VACUUM, ANALYZE, REINDEX, · eedb068c
      Tom Lane authored
      and CLUSTER) execute as the table owner rather than the calling user, using
      the same privilege-switching mechanism already used for SECURITY DEFINER
      functions.  The purpose of this change is to ensure that user-defined
      functions used in index definitions cannot acquire the privileges of a
      superuser account that is performing routine maintenance.  While a function
      used in an index is supposed to be IMMUTABLE and thus not able to do anything
      very interesting, there are several easy ways around that restriction; and
      even if we could plug them all, there would remain a risk of reading sensitive
      information and broadcasting it through a covert channel such as CPU usage.
      
      To prevent bypassing this security measure, execution of SET SESSION
      AUTHORIZATION and SET ROLE is now forbidden within a SECURITY DEFINER context.
      
      Thanks to Itagaki Takahiro for reporting this vulnerability.
      
      Security: CVE-2007-6600
      eedb068c
    • Tom Lane's avatar
      Fix assorted security-grade bugs in the regex engine. All of these problems · 98f27aae
      Tom Lane authored
      are shared with Tcl, since it's their code to begin with, and the patches
      have been copied from Tcl 8.5.0.  Problems:
      
      CVE-2007-4769: Inadequate check on the range of backref numbers allows
      crash due to out-of-bounds read.
      CVE-2007-4772: Infinite loop in regex optimizer for pattern '($|^)*'.
      CVE-2007-6067: Very slow optimizer cleanup for regex with a large NFA
      representation, as well as crash if we encounter an out-of-memory condition
      during NFA construction.
      
      Part of the response to CVE-2007-6067 is to put a limit on the number of
      states in the NFA representation of a regex.  This seems needed even though
      the within-the-code problems have been corrected, since otherwise the code
      could try to use very large amounts of memory for a suitably-crafted regex,
      leading to potential DOS by driving the system into swap, activating a kernel
      OOM killer, etc.
      
      Although there are certainly plenty of ways to drive the system into effective
      DOS with poorly-written SQL queries, these problems seem worth treating as
      security issues because many applications might accept regex search patterns
      from untrustworthy sources.
      
      Thanks to Will Drewry of Google for reporting these problems.  Patches by Will
      Drewry and Tom Lane.
      
      Security: CVE-2007-4769, CVE-2007-4772, CVE-2007-6067
      98f27aae
    • Tom Lane's avatar
      Forbid ALTER TABLE and CLUSTER when there are pending AFTER-trigger events · 20e86215
      Tom Lane authored
      in the current backend for the target table.  These operations move tuples
      around and would thus invalidate the TIDs stored in the trigger event records.
      (We need not worry about events in other backends, since acquiring exclusive
      lock should be enough to ensure there aren't any.)  It might be sufficient
      to forbid only the table-rewriting variants of ALTER TABLE, but in the absence
      of any compelling use-case, let's just be safe and simple.  Per follow-on
      investigation of bug #3847, though this is not actually the same problem
      reported therein.
      
      Possibly this should be back-patched, but since the case has never been
      reported from the field, I didn't bother.
      20e86215
  2. Jan 02, 2008
  3. Jan 01, 2008
  4. Dec 28, 2007
    • Tom Lane's avatar
      Improve consistency of error reporting in GUC assign_hook routines. Some · 5233dc15
      Tom Lane authored
      were reporting ERROR for interactive assignments and LOG for other cases,
      some were saying nothing for non-interactive cases, and a few did yet other
      things.  Make them use a new function GUC_complaint_elevel() to establish
      a reasonably uniform policy about how to report.  There are still a few
      edge cases such as assign_search_path(), but it's much better than before.
      Per gripe from Devrim Gunduz and subsequent discussion.
      
      As noted by Alvaro, it'd be better to fold these custom messages into the
      standard "invalid parameter value" complaint from guc.c, perhaps as the DETAIL
      field.  However that will require more redesign than seems prudent for 8.3.
      This is a relatively safe, low-impact change that we can afford to risk now.
      5233dc15
  5. Dec 11, 2007
  6. Dec 08, 2007
    • Tom Lane's avatar
      Fix mergejoin cost estimation so that we consider the statistical ranges of · 9fd88436
      Tom Lane authored
      the two join variables at both ends: not only trailing rows that need not be
      scanned because there cannot be a match on the other side, but initial rows
      that will be scanned without possibly having a match.  This allows a more
      realistic estimate of startup cost to be made, per recent pgsql-performance
      discussion.  In passing, fix a couple of bugs that had crept into
      mergejoinscansel: it was not quite up to speed for the task of estimating
      descending-order scans, which is a new requirement in 8.3.
      9fd88436
  7. Dec 03, 2007
  8. Dec 02, 2007
    • Tom Lane's avatar
      Code review for LIKE ... INCLUDING INDEXES patch. Fix failure to propagate · 265f904d
      Tom Lane authored
      constraint status of copied indexes (bug #3774), as well as various other
      small bugs such as failure to pstrdup when needed.  Allow INCLUDING INDEXES
      indexes to be merged with identical declared indexes (perhaps not real useful,
      but the code is there and having it not apply to LIKE indexes seems pretty
      unorthogonal).  Avoid useless work in generateClonedIndexStmt().  Undo some
      poorly chosen API changes, and put a couple of routines in modules that seem
      to be better places for them.
      265f904d
  9. Nov 30, 2007
    • Tom Lane's avatar
      Avoid incrementing the CommandCounter when CommandCounterIncrement is called · 895a94de
      Tom Lane authored
      but no database changes have been made since the last CommandCounterIncrement.
      This should result in a significant improvement in the number of "commands"
      that can typically be performed within a transaction before hitting the 2^32
      CommandId size limit.  In particular this buys back (and more) the possible
      adverse consequences of my previous patch to fix plan caching behavior.
      
      The implementation requires tracking whether the current CommandCounter
      value has been "used" to mark any tuples.  CommandCounter values stored into
      snapshots are presumed not to be used for this purpose.  This requires some
      small executor changes, since the executor used to conflate the curcid of
      the snapshot it was using with the command ID to mark output tuples with.
      Separating these concepts allows some small simplifications in executor APIs.
      
      Something for the TODO list: look into having CommandCounterIncrement not do
      AcceptInvalidationMessages.  It seems fairly bogus to be doing it there,
      but exactly where to do it instead isn't clear, and I'm disinclined to mess
      with asynchronous behavior during late beta.
      895a94de
  10. Nov 28, 2007
    • Tom Lane's avatar
      Adjust the names of a couple of tsearch index support functions that had · 11fccbea
      Tom Lane authored
      inappropriately generic-sounding names.  This is more or less free since
      we already forced initdb for the next beta, and it may prevent confusion or
      name conflicts (particularly at the C-global-symbol level) down the road.
      Per my proposal yesterday.
      11fccbea
    • Tom Lane's avatar
      Install a lookaside cache to speed up repeated lookups of the same operator · d54ca567
      Tom Lane authored
      by short-circuiting schema search path and ambiguous-operator resolution
      computations.  Remarkably, this buys as much as 45% speedup of repetitive
      simple queries that involve operators that are not an exact match to the
      input datatypes.  It should be marginally faster even for exact-match
      cases, though I've not had success in proving an improvement in benchmark
      tests.  Per report from Guillame Smet and subsequent discussion.
      d54ca567
  11. Nov 27, 2007
  12. Nov 24, 2007
  13. Nov 22, 2007
  14. Nov 16, 2007
  15. Nov 15, 2007
  16. Nov 13, 2007
  17. Nov 11, 2007
    • Tom Lane's avatar
      Ensure that typmod decoration on a datatype name is validated in all cases, · 0bd4da23
      Tom Lane authored
      even in code paths where we don't pay any subsequent attention to the typmod
      value.  This seems needed in view of the fact that 8.3's generalized typmod
      support will accept a lot of bogus syntax, such as "timestamp(foo)" or
      "record(int, 42)" --- if we allow such things to pass without comment,
      users will get confused.  Per a recent example from Greg Stark.
      
      To implement this in a way that's not very vulnerable to future
      bugs-of-omission, refactor the API of parse_type.c's TypeName lookup routines
      so that typmod validation is folded into the base lookup operation.  Callers
      can still choose not to receive the encoded typmod, but we'll check the
      decoration anyway if it's present.
      0bd4da23
  18. Nov 09, 2007
  19. Nov 08, 2007
    • Tom Lane's avatar
      Fix EquivalenceClass code to handle volatile sort expressions in a more · c291203c
      Tom Lane authored
      predictable manner; in particular that if you say ORDER BY output-column-ref,
      it will in fact sort by that specific column even if there are multiple
      syntactic matches.  An example is
      	SELECT random() AS a, random() AS b FROM ... ORDER BY b, a;
      While the use-case for this might be a bit debatable, it worked as expected
      in earlier releases, so we should preserve the behavior for 8.3.  Per my
      recent proposal.
      
      While at it, fix convert_subquery_pathkeys() to handle RelabelType stripping
      in both directions; it needs this for the same reasons make_sort_from_pathkeys
      does.
      c291203c
    • Tom Lane's avatar
      Last week's patch for make_sort_from_pathkeys wasn't good enough: it has · 1be06016
      Tom Lane authored
      to be able to discard top-level RelabelType nodes on *both* sides of the
      equivalence-class-to-target-list comparison, since make_pathkey_from_sortinfo
      might either add or remove a RelabelType.  Also fix the latter to do the
      removal case cleanly.  Per example from Peter.
      1be06016
  20. Nov 07, 2007
    • Tom Lane's avatar
      Improve the performance of LIKE/regex estimation in non-C locales, by making · 2de946be
      Tom Lane authored
      make_greater_string() try harder to generate a string that's actually greater
      than its input string.  Before we just assumed that making a string that was
      memcmp-greater was enough, but it is easy to generate examples where this is
      not so when the locale is not C.  Instead, loop until the relevant comparison
      function agrees that the generated string is greater than the input.
      
      Unfortunately this is probably not enough to guarantee that the generated
      string is greater than all extensions of the input, so we cannot relax the
      restriction to C locale for the LIKE/regex index optimization.  But it should
      at least improve the odds of getting a useful selectivity estimate in
      prefix_selectivity().  Per example from Guillaume Smet.
      
      Backpatch to 8.1, mainly because that's what the complainant is using...
      2de946be
    • Peter Eisentraut's avatar
  21. Nov 05, 2007
  22. Oct 29, 2007
    • Tom Lane's avatar
      Remove the hack in the grammar that "optimized away" DEFAULT NULL clauses. · b17b7fae
      Tom Lane authored
      Instead put in a test to drop a NULL default at the last moment before
      storing the catalog entry.  This changes the behavior in a couple of ways:
      * Specifying DEFAULT NULL when creating an inheritance child table will
        successfully suppress inheritance of any default expression from the
        parent's column, where formerly it failed to do so.
      * Specifying DEFAULT NULL for a column of a domain type will correctly
        override any default belonging to the domain; likewise for a sub-domain.
      The latter change happens because by the time the clause is checked,
      it won't be a simple null Const but a CoerceToDomain expression.
      
      Personally I think this should be back-patched, but there doesn't seem to
      be consensus for that on pgsql-hackers, so refraining.
      b17b7fae
    • Magnus Hagander's avatar
      6f14effb
  23. Oct 27, 2007
Loading