Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp1232595ybn; Wed, 25 Sep 2019 14:42:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqwQEC7mmeDHrvTtQO2QHoMIShuhO+vFLrj5rHY4BkDa5TgdNQl8mnVoaZVUiNymY8vJgFmF X-Received: by 2002:a17:906:f82:: with SMTP id q2mr255271ejj.143.1569447763490; Wed, 25 Sep 2019 14:42:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569447763; cv=none; d=google.com; s=arc-20160816; b=xyiFaYwmI9trGZ84bPy/9x+AMUGPGl1HA8Y7ZFxo35tIyJ3+2GdNrIHbJi+WmbU8jM zzAriaPdDD6LYJM37AcGETierpL6aeq7szxsPiBMC452iQgFpAYbdrOOOCWHgnHiuDMc wRRVaf0eaWBfibGHuaKNiKC6tpB/1Oer3DEHvVQjAlo1qQ+2DFcPxwawScRAHy07ndLx UD+Z78QEFu2d/eySWVvlsb9+/9/B1plEWwXLbu3F6UmmyJfH/bJIW7wW/hglHhKXYQJm Ue6Y/4VfbA4H5MYkckEw0JGLFZqJ8IJdYyWAndg266WLHNMOZPaBrGKaiqwflY4fxPeH OmnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=v9nT8Pun3Umtg+ZyKRl8psnS347C59XnrxNgbB7fYcI=; b=mth/SQ98mWG21YJgAJhfNCASFSvif4S6JuHIHvojGUMOcg6YkEvUegBNA9cvekuE4Y 3z7TJuPwj8j8VcMH51RUfTikcqaXnuXhAuLu+QIufrkXo5sKkK/eH9sHb0HMLY4RABQc AIAXx3h4zvPf7Bio8g20ruvlSyc2pMI7hYKWLZhTQ+txq4ujHouqYkhkBqFCgKTjpAel NuBKAemyHSiK5QnwH4yug5O3WDS7uyfYNIs3TiEDaDqfrasPMM9BZ7PznbVMmMmX/oRj E0UzjkelcHOoM/+/6GtfFVJtZVr3VZkWLRYiZN1iDdtj+Y4jygg3OdknZR4wmO7Xa3CF Y/cA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ricmx6ts; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g21si58030ejk.23.2019.09.25.14.42.18; Wed, 25 Sep 2019 14:42:43 -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; dkim=pass header.i=@kernel.org header.s=default header.b=ricmx6ts; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727116AbfIWSdg (ORCPT + 99 others); Mon, 23 Sep 2019 14:33:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:60826 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726678AbfIWSdg (ORCPT ); Mon, 23 Sep 2019 14:33:36 -0400 Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) (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 7388A2168B 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-f49.google.com with SMTP id l3so15097359wru.7 for ; Mon, 23 Sep 2019 11:33:34 -0700 (PDT) X-Gm-Message-State: APjAAAWAXoeX9Gx/DFRIxEXJZZVhOiW+5ZX0/tU03UpsgBoExilreax4 iR/l3FyQZNinuReaueNqYMJHUan9xnjK+/80d8vj6A== 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-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@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.