pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Guard against rare RAND_bytes() failures in pg_strong_random(). 3+ messages / 1 participants [nested] [flat]
* pgsql: Guard against rare RAND_bytes() failures in pg_strong_random(). @ 2018-07-20 08:12 Dean Rasheed <dean.a.rasheed@gmail.com> 0 siblings, 0 replies; 3+ messages in thread From: Dean Rasheed @ 2018-07-20 08:12 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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 ------ master Details ------- https://git.postgresql.org/pg/commitdiff/8f6ce7fb090a674f18b72e89a2b868fe1343fe8f Modified Files -------------- src/port/pg_strong_random.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) ^ permalink raw reply [nested|flat] 3+ messages in thread
* pgsql: Guard against rare RAND_bytes() failures in pg_strong_random(). @ 2018-07-20 08:12 Dean Rasheed <dean.a.rasheed@gmail.com> 0 siblings, 0 replies; 3+ messages in thread From: Dean Rasheed @ 2018-07-20 08:12 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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_11_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/1f919e663ee20430dfde5614a025ac2dbd0f4bfb Modified Files -------------- src/port/pg_strong_random.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) ^ permalink raw reply [nested|flat] 3+ messages in thread
* pgsql: Guard against rare RAND_bytes() failures in pg_strong_random(). @ 2018-07-20 08:12 Dean Rasheed <dean.a.rasheed@gmail.com> 0 siblings, 0 replies; 3+ messages in thread From: Dean Rasheed @ 2018-07-20 08:12 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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(+) ^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2018-07-20 08:12 UTC | newest] Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2018-07-20 08:12 pgsql: Guard against rare RAND_bytes() failures in pg_strong_random(). Dean Rasheed <dean.a.rasheed@gmail.com> 2018-07-20 08:12 pgsql: Guard against rare RAND_bytes() failures in pg_strong_random(). Dean Rasheed <dean.a.rasheed@gmail.com> 2018-07-20 08:12 pgsql: Guard against rare RAND_bytes() failures in pg_strong_random(). Dean Rasheed <dean.a.rasheed@gmail.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox