Skip to content
Snippets Groups Projects
  1. Feb 05, 2018
    • Tom Lane's avatar
      Last-minute updates for release notes. · cbe0dd58
      Tom Lane authored
      Security: CVE-2018-1052, CVE-2018-1053
      cbe0dd58
    • Peter Eisentraut's avatar
      Translation updates · dc6fb453
      Peter Eisentraut authored
      Source-Git-URL: git://git.postgresql.org/git/pgtranslation/messages.git
      Source-Git-Hash: 8d2416b5dc311bbf942125650a2d2c162a4f5453
      dc6fb453
    • Tom Lane's avatar
      Ensure that all temp files made during pg_upgrade are non-world-readable. · 6ba52aeb
      Tom Lane authored
      pg_upgrade has always attempted to ensure that the transient dump files
      it creates are inaccessible except to the owner.  However, refactoring
      in commit 76a7650c broke that for the file containing "pg_dumpall -g"
      output; since then, that file was protected according to the process's
      default umask.  Since that file may contain role passwords (hopefully
      encrypted, but passwords nonetheless), this is a particularly unfortunate
      oversight.  Prudent users of pg_upgrade on multiuser systems would
      probably run it under a umask tight enough that the issue is moot, but
      perhaps some users are depending only on pg_upgrade's umask changes to
      protect their data.
      
      To fix this in a future-proof way, let's just tighten the umask at
      process start.  There are no files pg_upgrade needs to write at a
      weaker security level; and if there were, transiently relaxing the
      umask around where they're created would be a safer approach.
      
      Report and patch by Tom Lane; the idea for the fix is due to Noah Misch.
      Back-patch to all supported branches.
      
      Security: CVE-2018-1053
      6ba52aeb
    • Tom Lane's avatar
      Fix RelationBuildPartitionKey's processing of partition key expressions. · fe921a36
      Tom Lane authored
      Failure to advance the list pointer while reading partition expressions
      from a list results in invoking an input function with inappropriate data,
      possibly leading to crashes or, with carefully crafted input, disclosure
      of arbitrary backend memory.
      
      Bug discovered independently by Álvaro Herrera and David Rowley.
      This patch is by Álvaro but owes something to David's proposed fix.
      Back-patch to v10 where the issue was introduced.
      
      Security: CVE-2018-1052
      fe921a36
  2. Feb 04, 2018
  3. Feb 03, 2018
  4. Feb 02, 2018
    • Peter Eisentraut's avatar
      Fix application of identity values in some cases · 1597948c
      Peter Eisentraut authored
      
      Investigation of 2d2d06b7 revealed that
      identity values were not applied in some further cases, including
      logical replication subscribers, VALUES RTEs, and ALTER TABLE ... ADD
      COLUMN.  To fix all that, apply the identity column expression in
      build_column_default() instead of repeating the same logic at each call
      site.
      
      For ALTER TABLE ... ADD COLUMN ... IDENTITY, the previous coding
      completely ignored that existing rows for the new column should have
      values filled in from the identity sequence.  The coding using
      build_column_default() fails for this because the sequence ownership
      isn't registered until after ALTER TABLE, and we can't do it before
      because we don't have the column in the catalog yet.  So we specially
      remember in ColumnDef the sequence name that we decided on and build a
      custom NextValueExpr using that.
      
      Reviewed-by: default avatarMichael Paquier <michael.paquier@gmail.com>
      1597948c
  5. Feb 01, 2018
  6. Jan 31, 2018
  7. Jan 30, 2018
  8. Jan 29, 2018
  9. Jan 28, 2018
    • Tom Lane's avatar
      Add stack-overflow guards in set-operation planning. · 1b2a3860
      Tom Lane authored
      create_plan_recurse lacked any stack depth check.  This is not per
      our normal coding rules, but I'd supposed it was safe because earlier
      planner processing is more complex and presumably should eat more
      stack.  But bug #15033 from Andrew Grossman shows this isn't true,
      at least not for queries having the form of a many-thousand-way
      INTERSECT stack.
      
      Further testing showed that recurse_set_operations is also capable
      of being crashed in this way, since it likewise will recurse to the
      bottom of a parsetree before calling any support functions that
      might themselves contain any stack checks.  However, its stack
      consumption is only perhaps a third of create_plan_recurse's.
      
      It's possible that this particular problem with create_plan_recurse can
      only manifest in 9.6 and later, since before that we didn't build a Path
      tree for set operations.  But having seen this example, I now have no
      faith in the proposition that create_plan_recurse doesn't need a stack
      check, so back-patch to all supported branches.
      
      Discussion: https://postgr.es/m/20180127050845.28812.58244@wrigleys.postgresql.org
      1b2a3860
    • Simon Riggs's avatar
      Default monitoring roles - errata · 76e117db
      Simon Riggs authored
      25fff407 introduced
      default monitoring roles. Apply these corrections:
      
      * Allow access to pg_stat_get_wal_senders()
        by role pg_read_all_stats
      
      * Correct comment in pg_stat_get_wal_receiver()
        to show it is no longer superuser-only.
      
      Author: Feike Steenbergen
      Reviewed-by: Michael Paquier
      
      Apply to HEAD, then later backpatch to 10
      76e117db
  10. Jan 27, 2018
    • Tom Lane's avatar
      Update time zone data files to tzdata release 2018c. · 2d71b270
      Tom Lane authored
      DST law changes in Brazil, Sao Tome and Principe.  Historical corrections
      for Bolivia, Japan, and South Sudan.  The "US/Pacific-New" zone has been
      removed (it was only a link to America/Los_Angeles anyway).
      2d71b270
    • Tom Lane's avatar
      Avoid crash during EvalPlanQual recheck of an inner indexscan. · 78433f41
      Tom Lane authored
      Commit 09529a70 changed nodeIndexscan.c and nodeIndexonlyscan.c to
      postpone initialization of the indexscan proper until the first tuple
      fetch.  It overlooked the question of mark/restore behavior, which means
      that if some caller attempts to mark the scan before the first tuple fetch,
      you get a null pointer dereference.
      
      The only existing user of mark/restore is nodeMergejoin.c, which (somewhat
      accidentally) will never attempt to set a mark before the first inner tuple
      unless the inner child node is a Material node.  Hence the case can't arise
      normally, so it seems sufficient to document the assumption at both ends.
      However, during an EvalPlanQual recheck, ExecScanFetch doesn't call
      IndexNext but just returns the jammed-in test tuple.  Therefore, if we're
      doing a recheck in a plan tree with a mergejoin with inner indexscan,
      it's possible to reach ExecIndexMarkPos with iss_ScanDesc still null,
      as reported by Guo Xiang Tan in bug #15032.
      
      Really, when there's a test tuple supplied during an EPQ recheck, touching
      the index at all is the wrong thing: rather, the behavior of mark/restore
      ought to amount to saving and restoring the es_epqScanDone flag.  We can
      avoid finding a place to actually save the flag, for the moment, because
      given the assumption that no caller will set a mark before fetching a
      tuple, es_epqScanDone must always be set by the time we try to mark.
      So the actual behavior change required is just to not reach the index
      access if a test tuple is supplied.
      
      The set of plan node types that need to consider this issue are those
      that support EPQ test tuples (i.e., call ExecScan()) and also support
      mark/restore; which is to say, IndexScan, IndexOnlyScan, and perhaps
      CustomScan.  It's tempting to try to fix the problem in one place by
      teaching ExecMarkPos() itself about EPQ; but ExecMarkPos supports some
      plan types that aren't Scans, and also it seems risky to make assumptions
      about what a CustomScan wants to do here.  Also, the most likely future
      change here is to decide that we do need to support marks placed before
      the first tuple, which would require additional work in IndexScan and
      IndexOnlyScan in any case.  Hence, fix the EPQ issue in nodeIndexscan.c
      and nodeIndexonlyscan.c, accepting the small amount of code duplicated
      thereby, and leave it to CustomScan providers to fix this bug if they
      have it.
      
      Back-patch to v10 where commit 09529a70 came in.  In earlier branches,
      the index_markpos() call is a waste of cycles when EPQ is active, but
      no more than that, so it doesn't seem appropriate to back-patch further.
      
      Discussion: https://postgr.es/m/20180126074932.3098.97815@wrigleys.postgresql.org
      78433f41
    • Magnus Hagander's avatar
      Add missing semicolons in documentation examples · 56067dee
      Magnus Hagander authored
      Author: Daniel Gustafsson <daniel@yesql.se>
      56067dee
  11. Jan 26, 2018
  12. Jan 24, 2018
  13. Jan 23, 2018
    • Tom Lane's avatar
      Teach reparameterize_path() to handle AppendPaths. · c5e59bb6
      Tom Lane authored
      If we're inside a lateral subquery, there may be no unparameterized paths
      for a particular child relation of an appendrel, in which case we *must*
      be able to create similarly-parameterized paths for each other child
      relation, else the planner will fail with "could not devise a query plan
      for the given query".  This means that there are situations where we'd
      better be able to reparameterize at least one path for each child.
      
      This calls into question the assumption in reparameterize_path() that
      it can just punt if it feels like it.  However, the only case that is
      known broken right now is where the child is itself an appendrel so that
      all its paths are AppendPaths.  (I think possibly I disregarded that in
      the original coding on the theory that nested appendrels would get folded
      together --- but that only happens *after* reparameterize_path(), so it's
      not excused from handling a child AppendPath.)  Given that this code's been
      like this since 9.3 when LATERAL was introduced, it seems likely we'd have
      heard of other cases by now if there were a larger problem.
      
      Per report from Elvis Pranskevichus.  Back-patch to 9.3.
      
      Discussion: https://postgr.es/m/5981018.zdth1YWmNy@hammer.magicstack.net
      c5e59bb6
    • Alvaro Herrera's avatar
      Remove unnecessary include · bfe23f83
      Alvaro Herrera authored
      autovacuum.c no longer needs dsa.h, since commit 31ae1638.
      Author: Masahiko Sawada
      Discussion: https://postgr.es/m/CAD21AoCWvYyXrvdANSHWWWEWJH5TeAWAkJ_2gqrHhukG+OBo1g@mail.gmail.com
      bfe23f83
    • Tom Lane's avatar
      5ca17d65
    • Robert Haas's avatar
      Report an ERROR if a parallel worker fails to start properly. · 383e4268
      Robert Haas authored
      Commit 28724fd9 fixed things so that
      if a background worker fails to start due to fork() failure or because
      it is terminated before startup succeeds, BGWH_STOPPED will be
      reported.  However, that only helps if the code that uses the
      background worker machinery notices the change in status, and the code
      in parallel.c did not.
      
      To fix that, do two things.  First, make sure that when a worker
      exits, it triggers the leader to read from error queues.  That way, if
      a worker which has attached to an error queue exits uncleanly, the
      leader is sure to throw some error, either the contents of the
      ErrorResponse sent by the worker, or "lost connection to parallel
      worker" if it exited without sending one.  To cover the case where
      the worker never starts up in the first place or exits before
      attaching to the error queue, the ParallelContext now keeps track
      of which workers have sent at least one message via the error
      queue.  A worker which sends no messages by the time the parallel
      operation finishes will be checked to see whether it exited before
      attaching to the error queue; if so, a new error message, "parallel
      worker failed to initialize", will be reported.  If not, we'll
      continue to wait until it either starts up and exits cleanly, starts
      up and exits uncleanly, or fails to start, and then take the
      appropriate action.
      
      Patch by me, reviewed by Amit Kapila.
      
      Discussion: http://postgr.es/m/CA+TgmoYnBgXgdTu6wk5YPdWhmgabYc9nY_pFLq=tB=FSLYkD8Q@mail.gmail.com
      383e4268
    • Bruce Momjian's avatar
      doc: simplify intermediate certificate mention in libpq docs · 5aaa8666
      Bruce Momjian authored
      Backpatch-through: 9.3
      5aaa8666
  14. Jan 22, 2018
    • Tom Lane's avatar
      Make pg_dump's ACL, sec label, and comment entries reliably identifiable. · 46246fd9
      Tom Lane authored
      _tocEntryRequired() expects that it can identify ACL, SECURITY LABEL,
      and COMMENT TOC entries that are for large objects by seeing whether
      the tag for them starts with "LARGE OBJECT ".  While that works fine
      for actual large objects, which are indeed tagged that way, it's
      subject to false positives unless every such entry's tag starts with an
      appropriate type ID.  And in fact it does not work for ACLs, because
      up to now we customarily tagged those entries with just the bare name
      of the object.  This means that an ACL for an object named
      "LARGE OBJECT something" would be misclassified as data not schema,
      with undesirable results in a schema-only or data-only dump ---
      although pg_upgrade seems unaffected, due to the special case for
      binary-upgrade mode further down in _tocEntryRequired().
      
      We can fix this by changing all the dumpACL calls to use the label
      strings already in use for comments and security labels, which do
      follow the convention of starting with an object type indicator.
      
      Well, mostly they follow it.  dumpDatabase() got it wrong, using
      just the bare database name for those purposes, so that a database
      named "LARGE OBJECT something" would similarly be subject to having
      its comment or security label dropped or included when not wanted.
      Bring that into line too.  (Note that up to now, database ACLs have
      not been processed by pg_dump, so that this issue doesn't affect them.)
      
      _tocEntryRequired() itself is not free of fault: it was overly liberal
      about matching object tags to "LARGE OBJECT " in binary-upgrade mode.
      This looks like it is probably harmless because there would be no data
      component to strip anyway in that mode, but at best it's trouble
      waiting to happen, so tighten that up too.
      
      The possible misclassification of SECURITY LABEL entries for databases is
      in principle a security problem, but the opportunities for actual exploits
      seem too narrow to be interesting.  The other cases seem like just bugs,
      since an object owner can change its ACL or comment for himself, he needn't
      try to trick someone else into doing it by choosing a strange name.
      
      This has been broken since per-large-object TOC entries were introduced
      in 9.0, so back-patch to all supported branches.
      
      Discussion: https://postgr.es/m/21714.1516553459@sss.pgh.pa.us
      46246fd9
Loading