Skip to content
Snippets Groups Projects
  1. Nov 24, 2017
  2. Nov 23, 2017
  3. Nov 21, 2017
  4. Nov 20, 2017
  5. Nov 18, 2017
  6. Nov 17, 2017
  7. Nov 16, 2017
  8. Nov 14, 2017
    • Tom Lane's avatar
      Prevent int128 from requiring more than MAXALIGN alignment. · 619a8c47
      Tom Lane authored
      Our initial work with int128 neglected alignment considerations, an
      oversight that came back to bite us in bug #14897 from Vincent Lachenal.
      It is unsurprising that int128 might have a 16-byte alignment requirement;
      what's slightly more surprising is that even notoriously lax Intel chips
      sometimes enforce that.
      
      Raising MAXALIGN seems out of the question: the costs in wasted disk and
      memory space would be significant, and there would also be an on-disk
      compatibility break.  Nor does it seem very practical to try to allow some
      data structures to have more-than-MAXALIGN alignment requirement, as we'd
      have to push knowledge of that throughout various code that copies data
      structures around.
      
      The only way out of the box is to make type int128 conform to the system's
      alignment assumptions.  Fortunately, gcc supports that via its
      __attribute__(aligned()) pragma; and since we don't currently support
      int128 on non-gcc-workalike compilers, we shouldn't be losing any platform
      support this way.
      
      Although we could have just done pg_attribute_aligned(MAXIMUM_ALIGNOF) and
      called it a day, I did a little bit of extra work to make the code more
      portable than that: it will also support int128 on compilers without
      __attribute__(aligned()), if the native alignment of their 128-bit-int
      type is no more than that of int64.
      
      Add a regression test case that exercises the one known instance of the
      problem, in parallel aggregation over a bigint column.
      
      Back-patch of commit 75180499.  The code known to be affected only exists
      in 9.6 and later, but we do have some stuff using int128 in 9.5, so patch
      back to 9.5.
      
      Discussion: https://postgr.es/m/20171110185747.31519.28038@wrigleys.postgresql.org
      619a8c47
    • Tom Lane's avatar
      Rearrange c.h to create a "compiler characteristics" section. · a8910506
      Tom Lane authored
      Generalize section 1 to handle stuff that is principally about the
      compiler (not libraries), such as attributes, and collect stuff there
      that had been dropped into various other parts of c.h.  Also, push
      all the gettext macros into section 8, so that section 0 is really
      just inclusions rather than inclusions and random other stuff.
      
      The primary goal here is to get pg_attribute_aligned() defined before
      section 3, so that we can use it with int128.  But this seems like good
      cleanup anyway.
      
      This patch just moves macro definitions around, and shouldn't result
      in any changes in generated code.
      
      Back-patch of commit 91aec93e.
      
      Discussion: https://postgr.es/m/20171110185747.31519.28038@wrigleys.postgresql.org
      a8910506
  9. Nov 13, 2017
  10. Nov 12, 2017
  11. Nov 11, 2017
  12. Nov 10, 2017
  13. Nov 09, 2017
  14. Nov 08, 2017
    • Tom Lane's avatar
      Allow --with-bonjour to work with non-macOS implementations of Bonjour. · 58bc9ea0
      Tom Lane authored
      On macOS the relevant functions require no special library, but elsewhere
      we need to pull in libdns_sd.
      
      Back-patch to supported branches.  No docs change since the docs do not
      suggest that this is a Mac-only feature.
      
      Luke Lonergan
      
      Discussion: https://postgr.es/m/2D8331C5-D64F-44C1-8717-63EDC6EAF7EB@brightforge.com
      58bc9ea0
    • Tom Lane's avatar
      Doc: fix erroneous example. · 6c05b815
      Tom Lane authored
      The grammar requires these options to appear the other way 'round.
      
      jotpe@posteo.de
      
      Discussion: https://postgr.es/m/78933bd0-45ce-690e-b832-a328dd1a5567@posteo.de
      6c05b815
    • Tom Lane's avatar
      Fix two violations of the ResourceOwnerEnlarge/Remember protocol. · 442bc416
      Tom Lane authored
      The point of having separate ResourceOwnerEnlargeFoo and
      ResourceOwnerRememberFoo functions is so that resource allocation
      can happen in between.  Doing it in some other order is just wrong.
      
      OpenTemporaryFile() did open(), enlarge, remember, which would leak the
      open file if the enlarge step ran out of memory.  Because fd.c has its own
      layer of resource-remembering, the consequences look like they'd be limited
      to an intratransaction FD leak, but it's still not good.
      
      IncrBufferRefCount() did enlarge, remember, incr-refcount, which would blow
      up if the incr-refcount step ever failed.  It was safe enough when written,
      but since the introduction of PrivateRefCountHash, I think the assumption
      that no error could happen there is pretty shaky.
      
      The odds of real problems from either bug are probably small, but still,
      back-patch to supported branches.
      
      Thomas Munro and Tom Lane, per a comment from Andres Freund
      442bc416
  15. Nov 07, 2017
    • Tom Lane's avatar
      Fix unportable usage of <ctype.h> functions. · e836502d
      Tom Lane authored
      isdigit(), isspace(), etc are likely to give surprising results if passed a
      signed char.  We should always cast the argument to unsigned char to avoid
      that.  Error in commit 63d6b97f, found by buildfarm member gaur.
      Back-patch to 9.3, like that commit.
      e836502d
    • Tom Lane's avatar
      Fix version numbering foulups exposed by 10.1. · 958fe549
      Tom Lane authored
      configure computed PG_VERSION_NUM incorrectly.  (Coulda sworn I tested
      that logic back when, but it had an obvious thinko.)
      
      pg_upgrade had not been taught about the new dispensation with just
      one part in the major version number.
      
      Both things accidentally failed to fail with 10.0, but with 10.1 we
      got the wrong results.
      
      Per buildfarm.
  16. Nov 06, 2017
    • Tom Lane's avatar
      Stamp 10.1. · 0b35d54c
      Tom Lane authored
      0b35d54c
    • Tom Lane's avatar
      Last-minute updates for release notes. · 50abeafc
      Tom Lane authored
      Security: CVE-2017-12172, CVE-2017-15098, CVE-2017-15099
      50abeafc
    • Tom Lane's avatar
      Make json{b}_populate_recordset() use the right tuple descriptor. · c30f082d
      Tom Lane authored
      json{b}_populate_recordset() used the tuple descriptor created from the
      query-level AS clause without worrying about whether it matched the actual
      input record type.  If it didn't, that would usually result in a crash,
      though disclosure of server memory contents seems possible as well, for a
      skilled attacker capable of issuing crafted SQL commands.  Instead, use
      the query-supplied descriptor only when there is no input tuple to look at,
      and otherwise get a tuple descriptor based on the input tuple's own type
      marking.  The core code will detect any type mismatch in the latter case.
      
      Michael Paquier and Tom Lane, per a report from David Rowley.
      Back-patch to 9.3 where this functionality was introduced.
      
      Security: CVE-2017-15098
      c30f082d
    • Noah Misch's avatar
      start-scripts: switch to $PGUSER before opening $PGLOG. · 6b0b983f
      Noah Misch authored
      By default, $PGUSER has permission to unlink $PGLOG.  If $PGUSER
      replaces $PGLOG with a symbolic link, the server will corrupt the
      link-targeted file by appending log messages.  Since these scripts open
      $PGLOG as root, the attack works regardless of target file ownership.
      
      "make install" does not install these scripts anywhere.  Users having
      manually installed them in the past should repeat that process to
      acquire this fix.  Most script users have $PGLOG writable to root only,
      located in $PGDATA.  Just before updating one of these scripts, such
      users should rename $PGLOG to $PGLOG.old.  The script will then recreate
      $PGLOG with proper ownership.
      
      Reviewed by Peter Eisentraut.  Reported by Antoine Scemama.
      
      Security: CVE-2017-12172
      6b0b983f
    • Dean Rasheed's avatar
      Always require SELECT permission for ON CONFLICT DO UPDATE. · 3f808957
      Dean Rasheed authored
      The update path of an INSERT ... ON CONFLICT DO UPDATE requires SELECT
      permission on the columns of the arbiter index, but it failed to check
      for that in the case of an arbiter specified by constraint name.
      
      In addition, for a table with row level security enabled, it failed to
      check updated rows against the table's SELECT policies when the update
      path was taken (regardless of how the arbiter index was specified).
      
      Backpatch to 9.5 where ON CONFLICT DO UPDATE and RLS were introduced.
      
      Security: CVE-2017-15099
      3f808957
Loading