From: | Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: Guard against rare RAND_bytes() failures in pg_strong_random(). |
Date: | 2018-07-20 08:12:27 |
Message-ID: | E1fgQWZ-0004jr-6e@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Guard against rare RAND_bytes() failures in pg_strong_random().
When built using OpenSSL, pg_strong_random() uses RAND_bytes() to
generate the random number. On very rare occasions that can fail, if
its PRNG has not been seeded with enough data. Additionally, once it
does fail, all subsequent calls will also fail until more seed data is
added. Since this is required during backend startup, this can result
in all new backends failing to start until a postmaster restart.
Guard against that by checking the state of OpenSSL's PRNG using
RAND_status(), and if necessary (very rarely), seeding it using
RAND_poll().
Back-patch to v10, where pg_strong_random() was introduced.
Dean Rasheed and Michael Paquier.
Discussion: https://postgr.es/m/CAEZATCXMtxbzSAvyKKk5uCRf9pNt4UV%2BF_5v%3DgLfJUuPxU4Ytg%40mail.gmail.com
Branch
------
REL_10_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/821200405cc3f25fda28c5f58d17d640e25559b8
Modified Files
--------------
src/port/pg_strong_random.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2018-07-20 17:59:45 | pgsql: Avoid unportable shell syntax in pg_upgrade's test script. |
Previous Message | Michael Paquier | 2018-07-20 00:32:59 | pgsql: Bump catalog version for recent toast table additions |