Re: PG 10: could not generate random cancel key - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: PG 10: could not generate random cancel key
Date
Msg-id 20180717130455.GA1629@paquier.xyz
Whole thread Raw
In response to PG 10: could not generate random cancel key  (Dean Rasheed <dean.a.rasheed@gmail.com>)
Responses Re: PG 10: could not generate random cancel key  (Dean Rasheed <dean.a.rasheed@gmail.com>)
List pgsql-hackers
On Tue, Jul 17, 2018 at 01:33:11PM +0100, Dean Rasheed wrote:
> Looking for precedents elsewhere, I found [2] which does exactly that,
> although I'm slightly dubious about the need for the for-loop there. I
> also found a thread [3], which recommends simply doing
>
> if (RAND_status() == 0)
>     RAND_poll();
>
> which seems preferable. Attached is a patch to do this in pg_strong_random().

Checking for the return result of RAND_poll() would also be good thing
to do.  From what I read in OpenSSL code it could fail as well, and
we could combine that with a loop attempted to feed the machinery a
decided amount of times, just failing after successive failures.
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Tomas Vondra
Date:
Subject: Re: [HACKERS] PATCH: multivariate histograms and MCV lists
Next
From: Haribabu Kommi
Date:
Subject: Re: [bug fix] Produce a crash dump before main() on Windows