From mboxrd@z Thu Jan 1 00:00:00 1970 From: Willy Tarreau Subject: Re: [PATCH RFC v4 1/1] random: WARN on large getrandom() waits and introduce getrandom2() Date: Fri, 20 Sep 2019 20:16:23 +0200 Message-ID: <20190920181623.GB1889@1wt.eu> References: <20190915052242.GG19710@mit.edu> <20190918211503.GA1808@darwi-home-pc> <20190918211713.GA2225@darwi-home-pc> <20190920134609.GA2113@pc> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org To: Linus Torvalds Cc: Andy Lutomirski , "Ahmed S. Darwish" , Lennart Poettering , "Theodore Y. Ts'o" , "Eric W. Biederman" , "Alexander E. Patrakov" , Michael Kerrisk , Matthew Garrett , lkml , Ext4 Developers List , Linux API , linux-man List-Id: linux-api@vger.kernel.org On Fri, Sep 20, 2019 at 11:09:53AM -0700, Linus Torvalds wrote: (...) > So: > > - GRND_INSECURE is (GRND_EXPLICIT | GRND_NONBLOCK) > > As in "I explicitly ask you not to just not ever block": urandom > > - GRND_SECURE_BLOCKING is (GRND_EXPLICIT | GRND_RANDOM) > > As in "I explicitly ask you for those secure random numbers" > > - GRND_SECURE_NONBLOCKING is (GRND_EXPLICIT | GRND_RANDOM | GRND_NONBLOCK) > > As in "I want explicitly secure random numbers, but return -EAGAIN > if that would block". > > Which are the three sane behaviors (that last one is useful for the "I > can try to generate entropy if you don't have any" case. I'm not sure > anybody will do it, but it definitely conceptually makes sense). > > And I agree that your naming is better. > > I had it as just "GRND_SECURE" for the blocking version, and > "GRND_SECURE | GRND_NONBLOCK" for the "secure but return EAGAIN if you > would need to block for entropy" version. > > But explicitly stating the blockingness in the name makes it clearer > to the people who just want GRND_INSECURE, and makes them realize that > they don't want the blocking version. I really like it this way. Explicit and full control for the application plus reasonable backwards compatibility, it sounds pretty good. Willy