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=-2.2 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 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 AB153C4360C for ; Thu, 26 Sep 2019 21:12:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 772CF20835 for ; Thu, 26 Sep 2019 21:12:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="AbFfvazG" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728865AbfIZVMD (ORCPT ); Thu, 26 Sep 2019 17:12:03 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:37065 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725919AbfIZVMD (ORCPT ); Thu, 26 Sep 2019 17:12:03 -0400 Received: by mail-wm1-f65.google.com with SMTP id f22so4011156wmc.2; Thu, 26 Sep 2019 14:11:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=FI1xrP5jjBsQPaMVmci1V+BqiWwo6aK8tEQUUDKJq3s=; b=AbFfvazGXAD0zLF3y6MQ+8btH+FUTb+dZuhxQtKDxqx3mkfuG65NeUr1xRvbqmcuLq 6LfIYygjn4F2QFxnjc5nhYV0lkjExxvDNgnAfOILhCrT1w+kjwOaAvFFtIErhLvagaTq m+WXGwXtHTv1IcmqgX4KzmJBWiiItqLoE5zpmSjhb5JDfp5wY48C8btfTQmHv10fK1sZ yPFI2gEWkVRyWgFxN5236PXiZlyibuJHUj1U0UQsXnXY6fV5/EP/WHYeNoI6Vri/QI4c KR7Yi1ZGpMVvU9M3Z9t4mOFgtIfaLEdjmVCLbkkQgGpKcwy2hfZQqaT9Y1sitRcnGphd a6vw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=FI1xrP5jjBsQPaMVmci1V+BqiWwo6aK8tEQUUDKJq3s=; b=AT2CyH4uO3MrY9MEXXYGKjWhYO3l0JzKv+GKqYNVM6m3OBJAcoUZEzG69ZiLCC5XWo vLiUfHTZymNymT/UVsZZ28jOJTFF8CouhANzod8ckUflUV65TbWB5TLhGJ4g16lxlKfQ XW7ASwU3ol1OrsK2niMjkdMwWC+a+4B5zIKBxKUWAg0QyeTdqoK1rw2A/QTH9A3WVrVu ah4Sde6znN5TYyF3qf/IewT19BXHR2dseiqDQ4tM+4KU+629TeapLXUdaa9383LJaLwb uYsthzkNfYO5NeKkaaBU1J+j/n9Yndq/IJT9E+nPLIm55u0ZLR1m9dZ8s/+KvisH0q8W P40Q== X-Gm-Message-State: APjAAAXTnPaI9B15Dq4bcJEJBqUXYxa7BdF7GmRhk4f++AtlahOxQ4OH xn32KM5MJjcr/rVvfnvcMYQ= X-Google-Smtp-Source: APXvYqxGVxier8ZJkkzbhZRUj2Md+Fotcwwj2JqZVqJYIFwEMitoJ12K0uooWAW12Ewj20nujf4mgQ== X-Received: by 2002:a7b:c932:: with SMTP id h18mr2178427wml.86.1569532319027; Thu, 26 Sep 2019 14:11:59 -0700 (PDT) Received: from darwi-home-pc ([5.158.153.52]) by smtp.gmail.com with ESMTPSA id g185sm8031301wme.10.2019.09.26.14.11.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Sep 2019 14:11:58 -0700 (PDT) Date: Thu, 26 Sep 2019 23:11:50 +0200 From: "Ahmed S. Darwish" To: Andy Lutomirski Cc: Florian Weimer , Linus Torvalds , 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 Subject: Re: [PATCH RFC v4 1/1] random: WARN on large getrandom() waits and introduce getrandom2() Message-ID: <20190926211150.GA1085@darwi-home-pc> References: <20190918211503.GA1808@darwi-home-pc> <20190918211713.GA2225@darwi-home-pc> <20190920134609.GA2113@pc> <87blvefai7.fsf@oldenburg2.str.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 23, 2019 at 11:33:21AM -0700, Andy Lutomirski wrote: > 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, ... This is what's now done in the just-submitted V5, except the "make the blocking mode work better" part: https://lkml.kernel.org/r/20190926204217.GA1366@pc It's a very conservative patch so far IMHO (minus the loud warning). Thanks, -- Ahmed Darwish