Received: by 2002:a25:b323:0:0:0:0:0 with SMTP id l35csp1788811ybj; Sun, 22 Sep 2019 11:58:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqyxiC9d8nQBkmkUoPQzP1M8aEl1NL8m5z8Ged0ETWROGkVAjGRzC186oYpldeQTRNRMnh+0 X-Received: by 2002:a17:906:20c7:: with SMTP id c7mr26689000ejc.248.1569178733965; Sun, 22 Sep 2019 11:58:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569178733; cv=none; d=google.com; s=arc-20160816; b=Maq1P14Qnft5cCok7DRH8Rm+DrjYAYZ+WTzb/e4IuQaoPy96J3qpKcnLOKKQ5ab/I1 4XuXh9B6c1BFZFexQby4BliR5zwNvf8C6vnVjGI6MYcEzrQVWgwp8GTP1nbBm/3xm5f2 /nH4JJ9RPko6fF/9jLiFEvpDyGX8osmna9qrClywrn7WtQtCgv9B33yu2JKxxHNMiFFw mTeYPxzjRcpitWqpt8VP9IXAgyfXaNSWyAoOf0hRkJVERIGvcl+9aJ/Ep+UCNrn0KDbx SiGAEAwqdLIYlLFmstQlc3KA3Bk/3mOvxJIateXxxzkPsa4XkRzHt2H37Em2UngGmDUZ 97iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=3eqvvlaKCvEDpdstFRHXosBkN3fjmQRuvEOUAHZQfe0=; b=1IxDZzdkoxO3IQj1lw6uZ/gQvyrnmX5CSIBY6rHYYghvahywGxY7cmbHKRh8LtF2CR 4IhI+2HwFkBF+70rzxCwLbwhJ649rM0GVMzG07rWWsdxzucc/1zibLeLMMSecq+Wf8bk S5FRb5U3EbNPZNS+PZW53LCJiRdNM2ibDtpylvhHaEkvUBk+WEmI8AqEQs/91HH9pDD5 GiM/jS4DIVZ6yTUDmGEr85RVrNk9SOFUyCGal1iB64LuRSXkq67+aozlez6nB+DXZqAs G8B+nM9bTEnkTJqHyXryQ6AaLD07brskEXZHWU3OU7FjTB36nO1cqAPtcO7GQrzr824u bXXQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a15si5315737eda.222.2019.09.22.11.58.29; Sun, 22 Sep 2019 11:58:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406344AbfITSQe (ORCPT + 99 others); Fri, 20 Sep 2019 14:16:34 -0400 Received: from wtarreau.pck.nerim.net ([62.212.114.60]:49235 "EHLO 1wt.eu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404864AbfITSQd (ORCPT ); Fri, 20 Sep 2019 14:16:33 -0400 Received: (from willy@localhost) by pcw.home.local (8.15.2/8.15.2/Submit) id x8KIGNXG001910; Fri, 20 Sep 2019 20:16:23 +0200 Date: Fri, 20 Sep 2019 20:16:23 +0200 From: Willy Tarreau 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 Subject: Re: [PATCH RFC v4 1/1] random: WARN on large getrandom() waits and introduce getrandom2() 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 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.6.1 (2016-04-27) Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@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