From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B679C4CECF for ; Mon, 23 Sep 2019 18:33:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 73B7020882 for ; Mon, 23 Sep 2019 18:33:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1569263620; bh=Fie3J0526jnQEvDaVDkC2sqZvgFQ5cq4HZDj0LraLR4=; h=References:In-Reply-To:From:Date:Subject:To:Cc:List-ID:From; b=dgenBEMvyq69xyJ68/Q/D00yZ3AKOZ1ezlpwJO6f5QdIUMcUKKIDufTx1iftxN5FH 8j63ndnSEG1aKFochMmldDw6jCf9/HLRpcBjisF6RjlIEyYPj4ojSc4ND6RQ7Fs1eJ cOtEUYalLMsIcwDlwwMbvM1o/XwIbxIQvcogEOgc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727303AbfIWSdg (ORCPT ); Mon, 23 Sep 2019 14:33:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:60840 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727246AbfIWSdg (ORCPT ); Mon, 23 Sep 2019 14:33:36 -0400 Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 834F621906 for ; Mon, 23 Sep 2019 18:33:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1569263614; bh=Fie3J0526jnQEvDaVDkC2sqZvgFQ5cq4HZDj0LraLR4=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=ricmx6tsBotMizJ+zHuuwiK2sol3/KXTKuRSEaSbi4iNFGpYtcgU8fx6hbXIOtwaX P9gJoaBeCHGASmi/tA+dwD5hiyK6FCTQ3UDeDeOQLhImRntdL3JnvsM11Rg41te5yB kX1HIBhO+w7V09bFtjrwR/YRPapbcuUrcR3ps7/Y= Received: by mail-wr1-f42.google.com with SMTP id a11so15167902wrx.1 for ; Mon, 23 Sep 2019 11:33:34 -0700 (PDT) X-Gm-Message-State: APjAAAVn4EjvIuiwPQ2vXeMgsVArp+6jicED2qQxJ3qYIleJXtEO5Yr3 y0YmqXHWca9YK4fiZkl5PjZE3b61YVOOWdLPpqjFxw== X-Google-Smtp-Source: APXvYqw4487lN/sv3jAQj37UY8zoRCqY7v0vsTXZ2t6ri4Fp48K86SQBOeh3CooGzzPErjZR5xwdGy1Bm2skBTf77KQ= X-Received: by 2002:adf:dbc6:: with SMTP id e6mr562368wrj.149.1569263612970; Mon, 23 Sep 2019 11:33:32 -0700 (PDT) MIME-Version: 1.0 References: <20190912034421.GA2085@darwi-home-pc> <20190912082530.GA27365@mit.edu> <20190914122500.GA1425@darwi-home-pc> <008f17bc-102b-e762-a17c-e2766d48f515@gmail.com> <20190915052242.GG19710@mit.edu> <20190918211503.GA1808@darwi-home-pc> <20190918211713.GA2225@darwi-home-pc> <20190920134609.GA2113@pc> <87blvefai7.fsf@oldenburg2.str.redhat.com> In-Reply-To: <87blvefai7.fsf@oldenburg2.str.redhat.com> From: Andy Lutomirski Date: Mon, 23 Sep 2019 11:33:21 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH RFC v4 1/1] random: WARN on large getrandom() waits and introduce getrandom2() To: Florian Weimer Cc: Linus Torvalds , Andy Lutomirski , "Ahmed S. Darwish" , Lennart Poettering , "Theodore Y. Ts'o" , "Eric W. Biederman" , "Alexander E. Patrakov" , Michael Kerrisk , Willy Tarreau , Matthew Garrett , lkml , Ext4 Developers List , Linux API , linux-man Content-Type: text/plain; charset="UTF-8" Sender: linux-man-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-man@vger.kernel.org On Fri, Sep 20, 2019 at 11:07 PM Florian Weimer wrote: > > * Linus Torvalds: > > > Violently agreed. And that's kind of what the GRND_EXPLICIT is really > > aiming for. > > > > However, it's worth noting that nobody should ever use GRND_EXPLICIT > > directly. That's just the name for the bit. The actual users would use > > GRND_INSECURE or GRND_SECURE. > > Should we switch glibc's getentropy to GRND_EXPLICIT? Or something > else? > > I don't think we want to print a kernel warning for this function. > Contemplating this question, I think the answer is that we should just not introduce GRND_EXPLICIT or anything like it. glibc is going to have to do *something*, and getentropy() is unlikely to just go away. The explicitly documented semantics are that it blocks if the RNG isn't seeded. Similarly, FreeBSD has getrandom(): https://www.freebsd.org/cgi/man.cgi?query=getrandom&sektion=2&manpath=freebsd-release-ports and if we make getrandom(..., 0) warn, then we have a situation where the *correct* (if regrettable) way to use the function on FreeBSD causes a warning on Linux. Let's just add GRND_INSECURE, make the blocking mode work better, and, if we're feeling a bit more adventurous, add GRND_SECURE_BLOCKING as a better replacement for 0, convince FreeBSD to add it too, and then worry about deprecating 0 once we at least get some agreement from the FreeBSD camp.